Quick Tip for Flash/JavaScript Debugging

I'm doing some debugging where I script a hidden Flash file with JavaScript. A common problem in Flash development outside of the Flash IDE is how to report debug information in a real application, especially if the Flash file is hidden. Here's a little trick I use whenever I want to report some debug information; this creates a JavaScript popup box with the given message:

Inside of Flash:
getURL("javascript:alert('hello world!')");

If you want to print out some variable, you could do the following:

getURL("javascript:alert('someVariable="+someVariable+"')");

Comments

Tacos said…
You can also put trace functions in your ActionScript and view the debug log using the Flash Content Debugger and a log viewer like FlashTracer for Firefox or TailXP for Windows.