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();
- 0 Comments



Your comment