[xray] Minimal connector-only code

Darren Cook darren at dcook.org
Thu Feb 2 20:03:13 EST 2006


Hi,
A few days ago I posted asking what some lines in the XrayLoadTest.as
example are doing. I've repeated them below [1], but I thought I'd
rephrase what I'm after and explain my motivation.

What I'm trying to do is work out the minimum amount of code I need to
add to an existing actionscript-only application to be able to use xray
with it. The immediate need is to enhance a HelloWorld app in a "linux
and osflash" tutorial I'm working on. But I have much more complex apps
I want to use xray with.

So, does anyone have a before/after example of what xray code needs to
be added to use the connector only swf? [2] is my code that does not work.

Darren



[1]
I got the XrayLoadTest.as file working!
But my HelloWorld app still doesn't connect. I guess I'm being too
minimal?  Can I ask some questions about XrayLoadTest.as?

Line 19: import Flashout;
  Is this required if I'm not using Flashout?

Line 21: Does my main class have to extend MovieClip in order to use
xray? Why?

Lines 34..38: This looks like it turns root into an instance of
XrayLoadTest? Is this just a style thing, or is it required in order to
use Xray?

Line 71: Is it required to set a LoadComplete event listener? Or can
Xray still work without?


[2]:
import com.blitzagency.xray.util.XrayLoader;

class HelloWorld{
/** Holds reference to the single global class that main() creates */
static var app:HelloWorld;

/** Constructor: does all the work */
function HelloWorld(){
var xray_loader:MovieClip=new MovieClip;
XrayLoader.loadConnector("ConnectorOnly_as2_fp7_OS_1.4.5.swf", xray_loader);

_root.createTextField("txt",10,0,0,0,0);
_root.txt.autoSize='left';
_root.txt.text="Hello World!";

_global.tt("Finished initializing HelloWorld");
}

/** Program entry point: creates one global instance of our class */
static function main(){
app=new HelloWorld();
}

}




More information about the xray mailing list