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:

XTrace Window

Instructions

  1. Grab the latest source of Zeroi from its Subversion Repository. You will find there the new extension for XTrace, too.
  2. Download and install XTrace. For enjoying the latest features (e.g. text highlighting) it’s recommended to use the XTrace SVN Repository.
  3. Download the Zeroi example and follow the steps 4 up to 7 described in my previous post called “Debugging with MTASC, Ant and Zeroi”.
  4. Add XTracePublisher as Zerois publisher to MTASC -trace flag. For this purpose you have to change only one line in the Ant script located in my example:
    1. <arg value="-trace"/>
    2. <arg value="org.osflash.Zeroi.logging.LoggerClass.log"/>
    3. <arg value="org/osflash/Zeroi/logging/LoggerClass"/>
    4. <!– point this argument to XTracePublisher –>
    5. <arg value="org/osflash/Zeroi/logging/publisher/XTracePublisher"/>
  5. 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 ./build

    Type then the following line for running MTASC:

    1.  
    2. {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
    3.  
    For opening the *.swf with the FlashPlayer type additionally:

    1.  
    2. open -a SAFlashPlayer ./deploy/zeroiExample.swf
    3.  

    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 ;-) .

Related Articles

Debugging | Flash | MTASC | Open Source | OS X

 

3 Comments

  • Tobias Goeschel says:

    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;
    }

  • sectore says:

    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

 

Leave a comment

*