Xray (The AdminTool) Connector Only Package

by Chris Allen

Introduction

In the past in order to use Xray (The AdminTool), Flash developers had to add Xray (The AdminTool)XrayLoader component to the library of the project’s main FLA and compile this using the Macromedia Flash MX2004 IDE. This method had several limitations including, but not limited to the following:

  • Flash programmers without the Flash IDE had no possibility of using Xray (The AdminTool).
  • The Xray component had to be incorporated into the project’s SWF and would need to be removed manually before deployment, rather than being able to dynamically set in A2 code whether to have the connector on or off.
  • Developers using MTASC had to first compile with Macromedia’s compiler and then use the -keep flag in MTASC in order for Xray (The AdminTool)XrayLoader component to not be lost.

In order to solve these shortcomings I worked closely with John Grden, creator of Xray (The AdminTool),to come up with this solution.

Overview

This new method of setting up Xray (The AdminTool) connection in your Flash project uses Xray XrayLoader component in an external SWF file that is loaded into your own SWF via the MovieClipLoader class to create the connection. This is conveniently done for you with the com.blitzagency.xray.util.XrayLoader utility class.

Configuring Xray files

  1. Download the .zip file containing the files that you will need and extract them to your computer’s hard drive. You can get the ZIP file here: download
  2. You will then need to add the com.blitzagency.xray.util package to your project. Simply place this structure into your classpath files.
  3. Next you will need to put the ConnectorOnly_as2_fp7_OS.swf in a directory that your main SWF can access it.
  4. If you want to use Xray (The AdminTool) as part of the Eclipse IDE you can do this with the PHP Browser plugin that comes with the PHPeclipse project. Sönke Rohde wrote a nice explanation of how to use this plugin here. Simply follow his directions and point the PHPBrowser to where you have put the xray_compact_[verision#].swf file.

The files should now be setup and now you can add the XrayLoader code to your project to get Xray (The AdminTool) running.

How to connect Xray (The AdminTool) using the XrayLoader class

This is esentially an easy three step process

  1. Import the com.blitzagency.xray.util.XrayLoader utility class
  2. Add the event listener for the XrayLoader.LoadComplete event
  3. Call the XrayLoader.loadConnector() method with the first argument being a path to the ConnectorOnly_as2_fp7_OS.swf.

Once the LoadComplete event is called Xray (The AdminTool) is ready to use. See the com.blitzagency.xray.util.XrayLoadTest.as file for details of how this works.

Using XrayLoader’s trace(), tt() and tf() methods

Xray comes with three methods that you can use to trace output to the output window of Xray (The AdminTool). These are typically called using _global. I implemented static methods of the XrayLoader class for clarity and for the simple fact that I don’t like having _global throughout my code. Here is a quick over view of how to use these new methods:

XrayLoader.trace()
Traces the supplied objects in Xray (The AdminTool). You can send anything you want to the trace method (objects, arrays, properties etc).

    XrayLoader.trace("This is my object", myObj);

More info can be found on Xray (The AdminTool) web site here and in the method docs.

XrayLoader.tt()
tt() was created as a shortcut rather than typing out "trace". It calls the exact same method that trace does.

    XrayLoader.tt("This is my object", myObj);

XrayLoader.tf()
tf() is used within function calls. It will output the name of the called function, the timeline in which it exists and the arguments sent.

NOTE: as of 1.2.7 this is still a relatively new and untested method in Xray. Try sending different object references if "this" doesn’t yield any results. Basically, it needs an object/timeline to loop to match up arguments.callee with.

More info on this method can be found here: New Features

    function foo(parm1, parm2, parm3) { XrayLoader.tf(arguments, this); }

Conclusion

I hope that you find the new XrayLoader class useful!

{ 1 comment… read it below or add one }

John October 16, 2006 at 9:30 am

The link to the tutorial is now fixed! Sorry about that everyone!

Leave a Comment

{ 2 trackbacks }

BLITZ Labs » Blog Archive » Using Xray (The AdminTool) without the Flash IDE
October 16, 2006 at 9:29 am
Xray (The AdminTool) Connector Only Package « Ramblings
November 13, 2006 at 6:05 pm