Extension for Zeroi: XTracePublisher
Xtrace is a popular debugger console on OS X for logging your trace() data outside the Flash IDE. For easier handling I decided to write an extension for Zeroi that keeps your standard trace() methods in your code.
Here is a screen of a XTrace window receiving Zerois debug messages:

Instructions
- Grab the latest source of Zeroi from its Subversion Repository. You will find there the new extension for XTrace, too.
- Download and install XTrace. For enjoying the latest features (e.g. text highlighting) it’s recommended to use the XTrace SVN Repository.
- Download the Zeroi example and follow the steps 4 up to 7 described in my previous post called “Debugging with MTASC, Ant and Zeroi”.
- Add XTracePublisher as Zerois publisher to MTASC
-traceflag. For this purpose you have to change only one line in the Ant script located in my example:-
<arg value="-trace"/>
-
<arg value="org.osflash.Zeroi.logging.LoggerClass.log"/>
-
<arg value="org/osflash/Zeroi/logging/LoggerClass"/>
-
<!– point this argument to XTracePublisher –>
-
<arg value="org/osflash/Zeroi/logging/publisher/XTracePublisher"/>
-
- If you familiar with Terminal you can also create a small shell script to run MTASC instead using Ant. Open Terminal, change directory
cd {path/to/downloaded/zeroiExample}
and create a new file named buildpico ./buildType then the following line for running MTASC:
For opening the *.swf with the FlashPlayer type additionally:-
-
{path/to/mtasc} -cp {path/to/your/own/core/classes} -cp {path/to/MM/core/classes} -cp {path/to/zeroi/class/package} -cp ./source/ -swf ./deploy/zeroiExample.swf ./ZeroiExample.as -trace org.osflash.Zeroi.logging.LoggerClass.log org/osflash/Zeroi/logging/LoggerClass org/osflash/Zeroi/logging/publisher/XTracePublisher -frame 1 -version 7 -v -main
-
-
-
open -a SAFlashPlayer ./deploy/zeroiExample.swf
-
Save the file, close pico and run the script typing
./build -
Wish list
- Adding more log levels, such as “INFO” and “FATAL”. I’ve got in contact with Michael Bianco
.
I have been trying to get zeroi and xtrace to work on Mac OS X 10.4, using eclipse and mtasc 1.12, but in its present form without much luck.
I then compared the XtracePublisher to the other Publisher modules, noticing there is a need to “slow down” the initialization process a little, as is often needed when Flash Player doesn’t allocate its Memory quick enough. I made a little change to the initialize() method, and now everything runs like a charm.
Maybe you might want to include this, or at least publish it for other users with the same problem:
private static function initialize(): Boolean
{
if( initialized && instance != undefined) return true;
var checker:Number;
checker = setInterval( function() : Boolean {
if( LoggerClass == undefined) return false;
if( DebugLight == undefined) return false;
//
clearInterval( checker );
XTracePublisher.instance = new XTracePublisher();
LoggerClass.getInstance().addListener( XTracePublisher.instance);
}, 100);
return true;
}
Hi Tobias,
thanks! Feel free to add it to Zeroi’s repository at Google Code: http://code.google.com/p/zeroi/source/checkout
Just drop me a line to add you as a member for this project at GC.
That’s why I love Open Source
Thanks again!
-Jens