SWFProfiler haXe'd

January 13th, 2010 »

I ported over a very good SWFProfiler that a fellow actionscripter wrote over a year ago.
It’s very useful especially to haXe‘rs when all we have to play with is the flash debug player, and for flash game devs to make sure our framerates stay up, and our memory is managed correctly.

original author shanem (Shane McCartney) as3-swf-profiler

I added my own flavor to this already awesome SWFProfiler.


Usage: SWFProfiler.init( ?inspector_object_starting_point:Dynamic );  
Right-Click / Command-Click on the stage after SWFProfiler has been initialized.  
Choose "Show Profiler" to open the SWFProfiler  
Choose "Garbage Collector" to force gc().  
if SWFProfiler is visible, choose "Hide Profiler" to remove it from stage.  

Initialize without optional parameter: SWFProfiler.init();  
Will disable the Inspector function.  

To Enable the Inspector function, pass an object as the starting point to trace from.  
SWFProfiler.init(this);  

in the inspector textinput, use standard dot notation starting from the object passed  
 "field" or "object.field" or "object.object.field"  

the value of the field will display in the inspector value box (right half) if it exists  
the text in the inspector textinput will turn red if the field/object does not exist

enjoy flash swf profiling right-clicky graphing charting lining tracing fpsing haXing inlining juicy madness alpha zero point five goodness…

download SWFProfiler.hx

Demo

Click on the swf below to start/stop music.
Right-Click / Command-Click on the embedded swf to open the ContextMenu
Choose “Show Profiler” to open the SWFProfiler
Now i know you are rawkin’ your mom’s dual-core iMac, so you’re probably only seeing really high fps and my leet memory management ninjutsu makes the mem-history line plateau, so to get things moving around in this demo, you can grab your browser, and shake it like a polaroid picture for 5 seconds, you should see the fps line dip at least into yellow zone.
Here comes another fun part, i enabled the Inspector by passing my main class as the starting point to trace from. So with the SWFProfiler open, you should see “Inspector: stage.frameRate” to the right of that you will see the current value for that property. my main class has an object defined called stage. and Stage has a property called frameRate.
You can erase “stage.frameRate” and write whatever you want to inspect. here are some values to test out. just type away, and you’ll see the output as if you actually wrote “trace(object.property);”

Objects

some Main class properties

some other fun properties to play with

You need Flash 10 to view the awesome. It’s a free and fast upgrade.

[up arrow] speeds up sphere rotation speed
[down arrow] slows down sphere rotation speed
[left arrow] slows down sphere orbit speed
[right arrow] speeds up sphere orbit speed
[b] toggles background color white|black
[SPACEBAR] mutes/unmutes the music
[1] plays Enter Shikari - Johnny Sniper (5.5mb)
[2] plays Payami - Sweet Child of Mine (6.6mb)
[3] plays Genki Rockets - Intermediate -Orbit Swimming- (7.6mb)
[4] plays Kaskade - 4 AM (Adam K & Soha Radio Edit) (8.4mb)
[5] plays Shoupz Entertainment - Destroy She Said (Stryder) (4.2mb)
[6] plays DJ Loopy - Follow Me (6.2mb)

download SWFProfiler.hx

see source run
run source run

SWFProfiler.hx


2 Responses to “SWFProfiler haXe'd”

Say Anything