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.
Very handy, thanks! But I think you meant the import statement to be:
import org.flashdevelop.utils.xtrace;
~Nate