Monday, March 3, 2008
Programatic Output Panel Clearing
Monday, March 3, 2008
Debugging Flash code normally begins with inspection and then then escalates to tracing before other techniques are employed. Very useful stuff the trace statement.However sometimes your window becomes cluttered when debugging from within the Flash CS3 IDE, during each compile, and you might want to clear it out at times. If you're tracing in loops you feel this pain quite a bit.
Jesse Warden has a "ghetto solution" which works great. You can download the panel SWF right here.
How do I use this thing?
You need to locate your WindowSWF directory. On a PC you can find this someplace like this: C:\Documents and Settings\USERNAME\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\WindowSWF.
If you navigate to this location and no WindowSWF directory exists, go ahead and create one. On the Mac I’m not sure where this is, but it must be in a place pretty similar (within a Library).
- Copy the attached SWF to the WindowSWF directory
- Restart Flash
- After opening or creating a new FLA, Window > Other Panels > Trace Clear
- You can dock the panel someplace and save your workspace.
- The panel must be open (in the workspace, not necessarily showing) to work
//AS2:The panel SWF has a localConnection name of “JSFLBridge”, and a method called clearOutput. By using the localConnection and the method, you can call that method in the panel SWF, and that in turn fires off a line of JSFL that talks to the output panel in the IDE, telling it to clear itself. The code in the panel itself:
var lc = new LocalConnection();
function clearTraces():Void
{
lc.send( "JSFLBridge", "clearOutput");
};
//AS3 Document Class, etc.:
import flash.net.LocalConnection;
...
var lc:LocalConnection = new LocalConnection();
...
private function clearTraces():void
{
lc.send( “JSFLBridge”, “clearOutput” );
}
lc = new LocalConnection();So hopefully you’ll install this and find it useful. I slapped a button into my own panel so that I can use it instead of a right-click in the Output panel window itself. Using this technique isn't something I ever see come up very often, but with this tool available, it can make your life easier in the future.
lc.owner = this;
lc.clearOutput = function()
{
MMExecute("fl.outputPanel.clear()");
};
lc.connect("JSFLBridge");
Comments:
There are currently 0 Comments:

