Razorberry’s Adobe Flash Blog

December 21st, 2004

Self-contained AS2 Runtime Debug Console

Posted by Ash in Actionscript
Actionscript

I’ve been looking for one of these for a while, but nothing I found seemed to fit exactly what I wanted (isn’t that usually the case?). Apparently, as2lib is going to have a console soon. But being impatient I made my own, and I’ve provided it for download below.

I wanted a class I could include in my projects without dragging stuff from library to library, so the interface is entirely generated with actionscript. Just include it in your classpath, or import it in your actionscript, and call Debug.initialize(); somewhere early on in your movie.

You can look through your variables with a command line interface. Use ‘target (object)’ to choose what you want to inspect (with an absolute or relative path — you can’t use _parent though unfortunately). Use ‘list’ or ‘list (object)’ to see the contents of the object in question.
Watch a string or number with ‘watch (property)’, and stop watching it with ‘unwatch’.

Take a look, and let me know if you find it useful, or have ideas for improvement (I really wanted to colour-code the output but there was hassle with the formatting). Have a look at the code if you’re feeling adventurous (I’m sure my code isn’t the most understandable in the world).

Finally, the download link!

Debug.as

2 Responses to ' Self-contained AS2 Runtime Debug Console '

Subscribe to comments with RSS or TrackBack to ' Self-contained AS2 Runtime Debug Console '.

  1. on December 21st, 2004 at 4:00 pm

    Soungs cool - but all I get is a little red square that doesn’t seems to respond to any clicks - any suggestions? Could existing code in my project perhaps conlict with you code? (Haven’t tested Debug standalone, yet…)

  2. Ash said,
    on December 21st, 2004 at 4:28 pm

    Maybe something is blocking the button or there is some conflict somewhere. I’m not sure if this is Flash Player 7 only, so you could check that too.

    Easiest way to test the class:
    Create a new .fla in the same directory as Debug.as.
    On frame 2: Debug.initialize(); stop();
    Export.

    I tried to make the code so it doesn’t conflict with anything, but you never know..
    Let me know what you find out :)

    Oh.. you can also press ctrl+d instead of clicking the red button.

    Update: I just fixed a bug where the console can appear offscreen. Now it’s position is fixed. Something where Stage.width and Stage.height don’t correspond to the actual width and height of your movie :)

Leave a reply

:mrgreen: :neutral: :twisted: :shock: :smile: :???: :cool: :evil: :grin: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad:

Macromedia XML News Aggregator