Even better AS3 tracing in FlashDevelop

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.

This entry was posted in Flash. Bookmark the permalink.

One Response to Even better AS3 tracing in FlashDevelop

  1. Nate Chatellier says:

    Very handy, thanks! But I think you meant the import statement to be:
    import org.flashdevelop.utils.xtrace;
    ~Nate

Leave a Reply