Tuesday, April 11, 2006

debugging Flash Lite

This probably just comes under the Tip of the Day category rather than any detailed info on debugging in Flash Lite. Basically in Flash Lite because the actual device player is used in the IDE it means that the debugger doesn't work. So what can you do when occasionally standard traces and error messages don't provide enough information?

There are 2 methods I use. Firstly to get a general picture of where the problem lies you can change the publish version to Flash 5+ and use the debugger in the IDE. This is useful for checking for any undefined variables and allows you to use breakpoints to walk through code as it executes.

The second method I use which is particularly useful for getting a quick reference to any object or method calls that simply don't exist is to use the __resolve function. The __resolve function is a generic function that gets called whenever you reference a non-existant method or object. So for example, in Flash Lite sometimes the IDE will report: 'Problem with content 5: - Actionscript Processing'. If you change the publish settings to 6+ and then define the __resolve method of the Object prototype you can get the name of the non-existant method or object.

Object.prototype.__resolve = function(arg) {
trace("RESOLVE:"+arg);
};

There are plenty of other production techniques you can employ, especially for Flash Lite 2.0 development that make debugging a one click process, but I'll have to save those for a later date :)

Labels: