$.console – Flash Debugging Console

August 25th, 2007

The last couple of days have been pretty busy for me trying to make some progress with the Right-Click functionality in Flash 9, it is coming together pretty good and I hope to have a working Linux version very soon.

Besides that, I’m involved in some very cool Flash and AIR projects and I wanted to share some code with you that helps me in development on a daily basis.

$.console

So the concept behind the $.console is simple: make Actionscript 3 debugging easier and more portable. With that in mind I have developed a simple solution that can do the following:

  • you can see  trace() statements without external debugger right inside your application.
  • you can control the application at will (launch functions and set and remove variables).
  • you can hide it when you don’t need it (` key).
  • it’s lightweight (sample application is only 8Kb)
  • it uses AS3 Global Object

Sounds good? Let’s see some code!

Example Application:

Shows the maximum effort required to use $.console

Actionscript:
  1. package {
  2.    
  3.     import flash.display.*;
  4.     import lt.uza.utils.*;
  5.  
  6.     public class ConsoleTest extends Sprite
  7.     {
  8.        
  9.         private var $:Global = Global.init();
  10.        
  11.         public function ConsoleTest()
  12.         {
  13.            
  14.             // Initialize the Console.
  15.             $.console = new Console();
  16.  
  17.             // Show something.
  18.             $.trace("Hello World");
  19.             for (var i:int = 0; i<5; i++) {
  20.                   $.trace("n"+i);
  21.             }
  22.         }
  23.     }
  24. }


Screenshot:

Shows the console in action.

console in action

I hope you like it and find it useful as much as I do.

Download Source (v1.1)

Happy coding!

IDev.tv - Make Awesome Flash Websites

13 Responses to “$.console – Flash Debugging Console”

  1. Jon B Says:

    I cannot seem to hide the console with the tilde ~ key (SHIFT + #) - however the backtick ` key works for this purpose.

    This looks very useful :)

  2. Paulius Uza Says:

    You are right. I corrected the description in the post. Thanks :)

  3. Dave Says:

    Hi,

    I think this is a great Script. Nevertheless I found some bugs when I wanted to test it.

    1) None of the Keyboard-Keys worked for me (german keyboard), except escape. I added keycode 220 here, which works good.

    2) When I was adding the console to my Flex Application i the number of lines which where dispayed was limited. I traced 4 lines right after creating the console. when i then typed a command in the running application, it could'nt display more than 4 lines. The other lines were hidden. The only way to solve this problem was to set cacheAsBitmap = false; for the 2 textfields.

  4. Paulius Uza Says:

    Thanks for the great feedback Dave, I was wondering why it won't show up for some people. I will update the code ASAP

  5. cesarpo Says:

    Nice man thanks!

    having debug levels, will be sweet!

  6. Antony Says:

    Dog On Girl Sex...

    Find live, breaking sports news, live scores and all sports results here on Channel 9 Wide
    ...

  7. Corrado Says:

    Beastiality Clips...

    Sports news, match reports and leading sport comment from The Times and Sunday Times
    ...

  8. Nicholas Says:

    The ZIP file is no longer avaliable.

  9. sideDoor Says:

    Bummer, .zip is 404...

  10. HopingToDebug Says:

    Would love it if this were available for download again...

  11. dim Says:

    yes :( the link is broken

  12. Aki Says:

    Seems he changed the download system a bit... this should work:
    http://www.uza.lt/downloads/classes/AS3/AS3_console_test.zip

  13. lornetki sklep Says:

    What blog script do you use on your site ?

Leave a Reply