Even better AS3 tracing in FlashDevelop

Aug 01 2006 Published by under Flash

I realized that a package can contain a function directly, rather than going through a class. So you can do something like this:

[as]package org.flashdevelop.utils {
import flash.system.fscommand;
public function xtrace(msg:Object):void
{
fscommand(“trace”, msg.toString());
}
}[/as]

And save that in a file named xtrace.as.

Now you import the function:

import org.flashdevelop.xtrace;

and use it:

xtrace(“hello world”);

Note that simply naming it “trace” causes a conflict with the existing trace function.

2 responses so far. Comments will be closed after post is one year old.