Xray update: FLEX CHANGES – please read

5 11 2008

Thanks to Andy needing some help on a project, I was able to spend some quality time on Xray to fix a bug and enhance it to work with rawChildren containers in flex.  Above is a picture of the contents of rawChildren object in flex and a Papervision3D BasicView object highlighted.  I’m able to go from that point into the BasicView and see all the Papervision3D goodness ;)

I had to rework a few things to accomodate rawChildren types of objects, but in doing so, I made it more modular so to speak, in terms of the underlying code.  It’s been a struggle to not have to create copies of code that do nearly the same thing with slight tweaks for Flex.  So far so good.

NOTE:  I’ve finally changed the package and name of Flex2Xray.  I’ve basically dropped the “2″ in the folder name and the class.

So now we have:

com.blitzagency.xray.inspector.flex.FlexXray;
var xray:FlexXray = new FlexXray();

again, with the flex version, you don’t have to add it to stage since it has access to the Application object.





Papervision3D + Xray Introspection = FINALLY

28 10 2008

Man, after nearly 2 years of working with Papervision3D I FINALLY sat down and made it work with Papervision3D (and alot of other things).  Turns out it wasn’t that hard, I just needed to flip a switch to let other objects besides pure Objects and Array’s pass through to the interface.  It’s been digging through all of Papervision’s stuff all this time now, and I just needed to turn the key ;)   Well, there was a bit more with fixing a bug to support Dictionary’s now in Xray, but that’s all fixed now.

video: http://www.rockonflash.com/video/XrayPapervision3D.mov

You can see in this picture that I’m looking at a DisplayObject3D which is actually a child object of the loaded DAE.  You can change any of the properties you see there at runtime.  This makes it an extremely useful tool for debugging, but also for learning someone else’s application as well as optimization.  You can go through and change nearly any property at runtime to see who’s causin’ the problems.

The image below shows you the fix for Dictionarys.  DisplayObject3D’s children object is a Dictionary, and so now you can see all of it’s children and continue to click your way through to the end.  This is the group of panels in the QuadTree demo and you can see each one in the list of children.

I’ve committed the code and you can check out Xray here with your favorite svn client:
http://osflash-xray.googlecode.com/svn/trunk/

You can get the Xray interface here:

http://www.rockonflash.com/xray/flex/Xray.zip

The version you see in the video is the new AIR version which runs really well and as soon as I have time to package it up properly, I’ll release that version.

To get it working, put this in your code:

// create public var:
public var xray:Xray = new Xray();

// then, after you’re sure the stage is there in the main application:
addChild(xray);

Then just fire up the Xray Interface and hit the “go” button to take a snapshot and get started





Xray short walk-through video

12 10 2008

After seeing some of the replies on my last post, I thought doing a little video on what the AS3 version is capable would be a good idea.  So here’s a little walk through:

http://dl-client.getdropbox.com/u/36547/videos/xray/XrayWalkthrough_7Min.mov





Xray – Yes it does AS3 :)

11 10 2008

Well, for a while now, people have been asking me about using Xray with ActionScript3, so I thought I’d clear up the confusion with one post about it.

Yes – there is a version for AS3.  That’s the good news.  The bad news is, it doesn’t have all the bells and whistles that AS2 version had.  It DOES do introspection of your objects at runtime with a snapshot, and the logger is as strong as ever.  There’s also a Flex specific Xray class that works rather well.

The nice thing is, the logger and Xray work the same in either the Flash IDE, pure ActionScript project, Flex application or Air application.  It doesn’t have an AS3 component yet, but it works very easily with a couple lines of code just the same way.

Let’s take a look at doing 2 things: 1)  setting up an Xray instance for introspection and 2) just using the logger.

Xray Instance

To create an instance of Xray, you simply add the import to your class, then create an instance:

import com.blitzagency.xray.inspector.Xray;

// later in your property declarations:

public var xray:Xray = new Xray();

addChild(Xray);  // you have to add it to the stage in a pure ActionScript application or Flash IDE app – thanks Dave!

// for you Flex users – it works for Flex2 or Flex3 or Air

import com.blitzagency.xray.inspector.flex.Flex2Xray;

public var xray:Flex2Xray = new Flex2Xray();

Yay me!  we’re done and you can use the Flex Xray interface to take a look at your application.

Xray’s Logger

Xray’s logger has the same log levels that most do these days: debug, info, warn, error and fatal.  To create an instance of the Xray logger, you simply add the import, then create an instance like so:

import com.blitzagency.xray.logger.XrayLog;

// later in your property declarations:

public var log:XrayLog = new XrayLog();

// later, when you want to log something:

log.debug(“StringMessage”, object [, object, object...]);

log.info(“StringMessage”, object [, object, object...]);

log.warn(“StringMessage”, object [, object, object...]);

log.error(“StringMessage”, object [, object, object...]);

log.fatal(“StringMessage”, object [, object, object...]);

You pass a string message as the first argument, then send as many objects as you like after that.  The output is nice in that it includes a time stamp as well as the class and line number that made the log call:

(2793) com.electricsheepcompany.aspen.spaces::SpaceCreator/handleGroupLoaded()[/Users/NeoRiley/Documents/Infrared5/clients/clientName/source/johnBranch/src/1.0_jgrden/src/main/flex/com/clientName/clientAppName/spaces/SpaceCreator.as:102
GroupTest: group load complete

As you can see, you get the calling Class fine and line number. Nice huh?

Where do I get the code?!?

Glad you asked!  It’s hosted on Google code and you can check it out with any SVN client at this URL:

http://osflash-xray.googlecode.com/svn/trunk/

And the snazy Xray Interface app??

You can download the SWF based Xray app here

The future of Xray?

As usual, I’m sure Xray’s development will be driven by need on projects and by people who request features.  If anyone cries loud enough, I’m sure I’ll do what I can.  As I come to need more features that AS2 used to support, I’ll get around to implementing them.  But for now, it works well in AS3, and does what I need it to do, which is introspection and the ability to modify properties at runtime to see what’s going on with the application.  Much of my work these days is being a consultant on new gigs every couple of months and Xray really helps me cut through the felgercarb in mere sentons.

Also, there’s XrayViewer by Marc Hughes

Marc’s the one that did the work on the filter component for Xray’s log output, and came up with a really VERY cool AIR app that lets you load a SWF and inspect it ;)

http://rogue-development.com/xrayviewer.html





New Xray Viewer AIR Application – Marc Hughes

31 08 2007

This simply rocks – Marc’s created an XrayViewer that you load your SWF into and control it with some simple controls. Then, break out the normal Xray interface and look through it like nobodies business!

XrayViewer

Check it out:
http://www.rogue-development.com/blog/2007/08/xray-viewer.html

And yes, Xray’s got plans for the near future, but more on that later ;)








Follow

Get every new post delivered to your Inbox.