Debugging flash is tricky. Debugging it in a browser is even harder, since you can't trace things out. FlashTracer is great, but it only works after a moderately painful setup, you need the debug player installed, and it doesn't work for those times when you're using someone else's machine. Which is why we wrote DTDBug!
It's a simple way to see your Flash traces in a browser (as well as the regular IDE output pane). The only change to your workflow is an extra five characters! So instead of writing this:
trace("Hello world!");
you'd write this:
DTDBug.log("Hello world!");
Here's an example:
And here's the code it uses:
package { import au.com.dtdigital.core.dtdbug.DTDBug; import flash.display.MovieClip; public class DTDBugDemo extends MovieClip { public function DTDBugDemo() { // add DTDBug to the stage this.addChild(DTDBug.getInstance()); // allow usage on any URL DTDBug.addAllowedURL("*"); // log a test message DTDBug.log("Hello world!"); } }}
With addAllowedURL You can easily restrict which URLs it's enabled for (since there are probably times when you don't want people to be able to hit CTRL + SHIFT + SPACE and see your traces). We normally only use it on dev sites.
We hope you like it. If you find it useful, please let us know in the comments. A big thank you to Jarrod Cope for writing the original code!
Download DTDBug v1.0 (AS3 with example)