I use a debug console in all my projects. I cuts down on all my developing time and cuts down on all QA time as well. I can see all my traces directly in real time in the console and of course I can register and run cheat codes to run any piece of code I want. Since I'm mostly developing for mobile devices I used a functional modified version of my debug console but with the arrival of StageText it was time for me to create a specific mobile debug console and why not share it with anyone who can put it to good use. The MobileDebugConsole works with Flex and Flash for touch screen devices only.

With the MobileDebugConsole you will be able to run traces or output any texts directly into the console outputs. You can also create and register cheat codes (a function with or without parameters) with the console. As you type the name of an action, code hinting will appear and give you a list of possible action match that you can select. You can then pass parameters if needed (number or string) and hit return to run your cheat code. The code will then run, optionally any results will be outputted in the console and optionally the console will autoclose or not. And that's really all there is to it in term of functionality.


1. The console will switch the keyboard type depending on parameter types.

2. The console has a alpha ratio that can be set to set the transparency of the console (so you can see what's going in your app)

3. You do not need to manage the index depth of the console

4. You can set an overall color theme

5. You can set the text size and color used

6. You can set if the console autopan or not when the keyboard autopans

7. You can set a password and the time a user has to enter the console password before it autocloses.

8. The console handles itself its autoorientation (if your app autoorients) without the use of events.

9. The console uses 4 preregistered actions: clear (clear the output console), exit (exits the console), help (shows in console all registered actions and how to use them), dump (outputs all trace used since the start of the application directly in the console).

10. The console uses the ASWC.utiils.Tracer class for its internal tracing operation. (The Tracer class is an advanced tracing system)

Using the console is also very easy and adds only 15k of file size. Setting the console:


Use any system you want to open the console like the touch of a button for example:

mybutton.addEventListener(TouchEvent.TOUCH_TAP, handleTap);
protected function handleTap(event:TouchEvent):void

The console works only with Multitouch.inputMode set to TOUCH_POINT. If you are working with gestures simply set the input mode to touhpoint before opening the console and then back to gestures when the console closes.

MobileDebugConsole.getInstance().addEventListener(Event.CLOSE, handleClose);
mybutton.addEventListener(TouchEvent.TOUCH_TAP, handleTap);

protected function handleTap(event:TouchEvent):void
    Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

protected function handleClose(event:Event):void
    Multitouch.inputMode = MultitouchInputMode.GESTURE;

Other options:
MobileDebugConsole.getInstance().pan = true;
MobileDebugConsole.getInstance().textColor = 0xFF0000;
MobileDebugConsole.getInstance().textSize = 22;
MobileDebugConsole.getInstance().alphaRatio = 0.4;
MobileDebugConsole.getInstance().colorTheme = 0x000000;

Setting password:
//by defualt user will have 10 seconds to type the password before console closes

Set a password entering time:
MobileDebugConsole.getInstance().passwordTiming = 20;//20 seconds

Registering cheat codes:
var winlevel:ConsoleAction = new ConsoleAction("winlevel", winLevel, "Type this action to win the level");
var setnewscore:ConsoleAction = new ConsoleAction("setNewScore", adjustScore, "Set a new Score for the player", 1, 0, ["Number"], null);
setnewscore.autoClose = true;
private function winLevel():void { }
private function adjustScore(newscore:Number):void { }

And that is it. The swc and the docs are downloadable at the end of this article. If you like this class or like to see new feature implemented or like to report a bug feel free to contact me or drop a comment.