Archive for the ‘ActionScript’ Category

Debugging Flash Player with Firebug and Chrome

If you’ve ever used Firebug to debug Flash and Flex applications in a browser, consider using Danny Patterson’s FirebugTarget class instead. It hooks into the Flex Logging API, so the debug statements are omitted when you export a release build.

I also discovered that you don’t need Firebug and Firefox to take advantage of it: Google Chrome also has a JavaScript console. Simply choose Developer > JavaScript console, or press Ctrl+Shift+J on Windows. The JavaScript console opens in a new browser window. Very handy. 

You even get different icons for error and warn. Just remember to open the JavaScript console after you’ve loaded your app in Google Chrome.

Flash CS4 First Thoughts

Getting rusty with Flash authoring. Had to use Flash CS4 on a recent project and spent at least an hour searching for an elusive bug. I was adding instances of the Label component to a display list dynamically, and the last Label component kept disappearing. After a lot of trial and error, the solution was simple:

var label:Label = new Label();
label.autoSize = TextFieldAutoSize.LEFT;

I felt like such a newbie. Why autoSize is not “left” by default is a mystery (along with the useWeakReference default).

One thing’s for sure: After working with Flex Builder for two years, Flash CS4 is painful. No code-hinting, and no internal help system. What gives? If you press F1 in Flash CS4, it launches help in your default browser. What if you don’t have a network connection? No help?