robert hoekman, jr. / blog
Note: This is the old blog for rhjr.net. The new one is here.
DebugIt 1.0
We all know there are limited options for debugging Flash applications. The trace() command only allows one parameter (unless you concatenate them), and when running applications outside of the Flash authoring tool, we don't even have the luxury of using trace(). So we're left creating dynamic text fields on the stage to display information. It's not clean, it's not fun, and it's very easy to forget to remove the debug code. My answer to this is my newest extension, DebugIt 1.0.
DebugIt comes in two pieces: a component and a SWF.
The first piece is a component. Simply drop the DebugIt Sender component into any FLA you plan to publish for Flash Player 6 or higher. Then, call Debug.write(args) in your ActionScript, instead of trace(). Yes, it's a little more verbose than trace(), but with it, you get the following benefits:
1) You can pass more than one parameter in the method call. For example, calling "Debug.write(var1, var2, var3)" will display the value of each of the three variables in DebugIt Receiver, each on a new line.
2) DebugIt supports cross-domain communication, so you can debug applications outside of the Flash authoring tool, across multiple domains, before, during, or after deployment.
The second piece, as you may have guessed, is DebugIt Receiver. Run DebugIt Receiver (a SWF) at the same time you run your Flash application. The data you requested from your application will display in DebugIt Receiver.
It's as simple as that.
Download DebugIt now.
P.S. There's definitely room for DebugIt to grow, and I plan to keep adding water until it's all grown up. If you have suggestions, contact me.
DebugIt comes in two pieces: a component and a SWF.
The first piece is a component. Simply drop the DebugIt Sender component into any FLA you plan to publish for Flash Player 6 or higher. Then, call Debug.write(args) in your ActionScript, instead of trace(). Yes, it's a little more verbose than trace(), but with it, you get the following benefits:
1) You can pass more than one parameter in the method call. For example, calling "Debug.write(var1, var2, var3)" will display the value of each of the three variables in DebugIt Receiver, each on a new line.
2) DebugIt supports cross-domain communication, so you can debug applications outside of the Flash authoring tool, across multiple domains, before, during, or after deployment.
The second piece, as you may have guessed, is DebugIt Receiver. Run DebugIt Receiver (a SWF) at the same time you run your Flash application. The data you requested from your application will display in DebugIt Receiver.
It's as simple as that.
Download DebugIt now.
P.S. There's definitely room for DebugIt to grow, and I plan to keep adding water until it's all grown up. If you have suggestions, contact me.
8 Comments:
Very nice. I've started to make something similar several times and always got distracted. Personally, I would have done it with a class that is imported, rather than a component, but it comes down to personal preference.
I thought about that, but I figured it was simpler to drop a component into the SWF than to write the import statement. Matter of preference, I guess. Thanks for the feeback.
This post has been removed by the author.
This post has been removed by the author.
Another cool thing to add to it would be some recursive object tracing, like this: http://www.bit-101.com/blog/archives/000062.html
Indeed - I've thought about that myself. It would be nice to be able to trace out object properties and such, among other things. What I've got now is obviously very simple compared to what could be done. I imagine that when all is said and done, DebugIt will look nothing like the original. Thanks for the suggestion and the link. :)
Nice, can this be made to work with AS1?
I haven't used AS1 in a while, but I'm sure you could make an AS1 version. Your movie/app, though, would still have to be published for Flash Player 6 or higher because of the LocalConnection. Ping me directly (use the contact form in the About section of this site) and I can chat with you this weekend about it.
Post a Comment
<< Home