I’ve been getting a ColdFusion error on a remote server that I’m not getting when testing locally so obviously something is different between those 2 servers. I had thought to just try using a webservice call to the remote server to see if I could debug it better (the error I’m getting in Flex isn’t detailed enough to begin to track down the issue). The webservice I was testing is supposed to return back a complex object, but I was getting the error
Cannot perform web service invocation – Premature end of file
If I tested a return of just a string, it worked, but it did not like returning the complex object. After browsing around via Google for a bit, it seems that it may be related to nulls being returned in my complex object. Now I’m not sure how to fix this other than to add default values to my objects when they are returned (which I really don’t want, or *need* to do as calling it via Flash remoting works nicely), but debugging them via CF, not so optimal.
A coworker of mine has created a drag ‘n’ drop component that allows dragging between 2 items (base component is a ListBase, so it allows for greater flexibility of the list dataProviders). Today I needed to enable or disable the list components, but all it could do was disable the entire component. If the component was completely disabled, the user would not be able to scroll the list and see all of the items in it. We had decided that rather than just disabling everything, that we would just disable drag ‘n’ drop between the lists and remove the directional arrows that are also part of the component (left arrow pushes items from right to left, and vice versa for the right arrow).
I decided to override the enabled property of the component that this component was extending. Within this enabled, I was checking for initialization, then disabling drag for both lists and making the arrows invisible; however, once I compiled and ran the code I received a
RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/getChildAt()
I decided to try running debugger to see if it would give me the line of code that was throwing the error, but to no avail. I had tried gradually removing all of the items that I had added, but nothing worked. I even cleaned out my project and recompiled everything, but still no luck. It wasn’t until I undid everything I had added that it worked (as it should), but when I was testing, I had removed (almost) everything that I had added. The only thing I had not done was delete some image variables that I had moved from a private function to private variables at the top of the page, so I could access them within my “enabled” function. I put all of my code back in again and did not instantiate the image variables when I declared them, but rather in the creationComplete function, and no error.
After finally narrowing it down to the image instantiation, I tried instantiating the images on declaration and in the creationComplete function and, again, no error was thrown, so apparently it has something to do with trying to reference an image variable that is instantiated before creationComplete. I guess this goes hand-in-hand with “only instantiate your variables when you are going to use them”. Now that’s figured out…back to work