This ActionScript debugger console is not a specific feature of MiniBuilder. It is just a swc library that you can use in any Flash/AIR project, no matter the IDE you use.
For MiniBuilder, it comes as a default, one reason for this being that MiniBuilder doesn’t come with an embedded debugger.
To make a short digression here, actually few developers in the real world use a debugger. But first, let’s clear a little bit the terms:
- Debugger: a tool that, working together with (sometimes a special version of) the code interpreter (VM), can stop the program in predefined points (breakpoints), execute the code step by step and has other abilities like whatching variables, etc.
- Tracer or logger: a tool that allows code to execute “trace” commands that output values from the runtime environment. These trace statements have to be compiled with the application. Oftentimes, providers of such tools name them “console” but this is not appropriate. See next:
- Console: a tool that allows entering text commands to be executed against the running environment of the application. Take a look, for example, at the ubiquitous FF Firebug, or Developer Tools in Chrome browser. They both come with various tools including a real javascript console.
Without underestimating the power of a real debugger, I have to admit that on all the large Flash projects I’ve been part of during the years, none of the programmers did use the debugger regulary. Instead, most just used trace and even throw (funny, isn’t it?).
Now, what’s this thing that I’m presenting you under the name of DebuggerConsole? First of all, it is not a debugger. But indeed, it is a console in the proper meaning of the term. And a tracer. Although, I did not embed a real ActionScript interpretter (for reasons of size), DebuggerConsole can deal with assigns, simple binary opperators, method execution with parameters that can be references, all in the real running environment. And it even provides some code completion! Towards the running environment. How cool is that? Of course, it records previous commands in a history, similar to unix shell. The history is stored locally across sessions.
It’s been years since I can’t work without this console, and right now, I find little use in the debugger. It started back in the AS2 times and now it is much more powerful. You can make it show at startup, you can trigger it programatically or you can trigger it at runtime using javascript. In any case, it starts recording the traces right at the application start, no need to have it turned on. In case a problem shows up, just turn the console on using javascript and start inspecting the variables, or run code rigth there. Next time you might not be able to reproduce the bug!
One of the latest features we found useful to have is the ability to create trace namespaces. When several programmers work at the same project, the trace log gets quite big and you forget where traces come from. Using this feature you can associate your traces with a particular namespace, a simple string that the developer uses for a certain module. If, at runtime, you use the console to set a current namespace, you only see traces from that namespace. If you then turn namespace off, you can see all traces again. The current namespace is stored locally across the sessions.
Init the console in your application entry point:
Debugger.setParent(this, true);
The first param should be a display object that will be added to stage
The second param, tells the console to show right away. If set false, you can still show the console using javascript. You will need to call the function “debug()” on the object dom instance.
The trace command for DebuggerConsole is “debug”. Example:
debug('myVar=' + myVar);
to use a namespace, you need to issue something like this in your code:
debug(['module1', 'myVar=' + myVar]);
Here’s a video with a more detailed example. Forgive me for not adding the voice, I’m probably not such a good speaker anyway. Things to check in the video:
- Setting up the console
- Tracing, tracing with a namespace
- Setting a local reference in the compiled code to have it available in the console
- Using the console: print variables, assigning, running methods, code completion





