Currently the posts are filtered by: tools
Reset this filter to see all posts.
AST for AS3 (AST2)
This time i would like to show you the AS3 version of my ASToolBox. The AS3 version works a bit different than the AS2 version. I have split the whole tool into two components. There is a standalone applikation for all output data and a static class for use in your Flash file.
download: ast2.zip
You can find the installation instructions in the readme file.
To use AST you have to give it a reference to the stage.
- ...
- import at.lueftenegger.ast2.AST;
- ...
- AST.stage = stage;
- ...
- // The output and timer function are the same as in the AS2 version:
- AST.tracelocal("W");
- AST.trace("1");
- AST.clear();
- AST.trace("2");
- AST.traceStage();
- AST.var_dump(
- {
- _string:"Hello world!",
- _int:int(1),
- _uint:uint(2),
- _number:Number(3),
- _bool:Boolean(true),
- _array:[1,2,3],
- _object:{_a:"hello", _b:"world" },
- _nested:[ "a",
- "b",
- { c:"c",
- d:"d",
- e: [ 0,
- 1,
- 2
- ]
- },
- int(1),
- uint(2),
- Number(3)
- ],
- _xml: XML("<a>hello World</a>")
- }
- );
- // timer functions
- var u:Number;
- AST.timer_clear();
- var i:int = 0;
- for(i = 0; i < 10; i++){
- AST.timer_start();
- for(var x:int = 0; x < 1000000; x++)
- u = Math.sin(x)+Math.cos(i)+Math.random()/Math.cos(x);
- AST.timer_stop();
- }
- AST.timer_report();
- AST.timer_avg();
- //timer 2
- AST.timer_clear();
- for( i = 0; i < 3; i++){
- AST.timer_start();
- for( x = 0; x < 1000; x++)
- u = Math.sin(x)+Math.cos(i)+Math.random()/Math.cos(x);
- AST.timer_stop();
- }
- AST.timer_report();
- AST.timer_avg();
- // trace stage
- // this function is new to AST2
- // It gives a tree structure of the displaylist.
- AST.traceStage();
- for(i = 0; i<30; i++)
- addChild( new MovieClip() );
- AST.traceStage();
flash frame rate measurement(fps)
Frame rate measurement is an important topic in flash game development.
Goggle brings you a ton of scripts showing the current fame rate in a text field in a corner of your swf. But in your games you often have situations where the amount of calculations in/decreases very rapidly and you want to see at the first look how the frame rate if affected. For this a graph showing the frame rate is much better than the frame rate in a text field.
I would like to share a tool I wrote in 2006 and ported to AS3 last month.
download: http://www.lueftenegger.at/downloads/
Manual:
- green graph: shows the current frame rate.
- blue graph: shows the average frame rate of the last 50 frames.
- red graph: shows the average frame rate of the whole runtime.
To use the window, just drag the Symbol "fpsWindow" from the library on the stage.
To create it programmatically use the following code:
- // AS3:
- addChild(new fpsWindow());
- // AS2:
- _root.attachMovieClip("fpsWindow","fpsWindow",getNextHighestDepth());


