connectedpixel.com

actionscript, web development

Debugging

Detecting unwell xml

Submitted by joelmay on 4 January, 2007 - 9:07am.

If an XML file is created manually or edited manually, it is easy to misspell a closing tag, misplace a greater than sign or forget a quote mark – it's easy to create non-well-formed xml. Flash will not be able to read it and your application will fail. Furthermore, it might load some of the data and operate in a mysterious, crippled fashion, and the cause of the problem will not be obvious.

Preprocessor ASSERTS in ActionScript

Submitted by joelmay on 20 October, 2006 - 4:28pm.

Unlike most other computer languages, when ActionScript code fails, it fails silently. If my code sends an undefined argument to a function, there is no crash, no alert message, nothing scary.

Overall, this is a good thing. If my live swf hits a bug, it might work just fine, no one is the wiser and life goes goes on blissfully unaware.

This behavior has a downside, however. The bug that is ignored now might cascade into a serious problem later -- in the next frame or in some code far away from the source of the problem. And I'm left scratching my head trying to figure out the original source of the problem in my code. The appearance of the problem and the source of the problem may be far apart.

Component Array Parameter Gotcha

Submitted by joelmay on 22 November, 2005 - 11:18am.

So the other day, I was working on a component that has an inspectable set/get array property. I could not get it work. Although the default value for this array was not zero length and the parameter in the dialog box was not zero length, the set function was being called with a zero-length array at initialization.

This was an invalid situation and broke my app.

Here's a simplified version of the code:

XML feed