flashgameblog.at

22.11.2009
23:36

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.

 

  1. ...
  2. import at.lueftenegger.ast2.AST;
  3. ...
  4. AST.stage = stage;
  5. ...
  6.  
  7.  
  8. // The output and timer function are the same as in the AS2 version:
  9.  
  10. AST.tracelocal("W");
  11. AST.trace("1");
  12. AST.clear();
  13. AST.trace("2");
  14. AST.traceStage();
  15. AST.var_dump(
  16. {
  17.   _string:"Hello world!",
  18.   _int:int(1),
  19.   _uint:uint(2),
  20.   _number:Number(3),
  21.   _bool:Boolean(true),
  22.   _array:[1,2,3],
  23.   _object:{_a:"hello", _b:"world" },
  24.   _nested:[  "a",
  25.   "b",
  26.   {  c:"c",
  27.     d:"d",
  28.     e[  0,
  29.         1,
  30.         2
  31.       ]
  32.   },
  33.   int(1),
  34.   uint(2),
  35.   Number(3)
  36.       ],
  37.   _xml: XML("<a>hello World</a>")
  38. }
  39. );
  40.  
  41. // timer functions
  42. var u:Number;
  43. AST.timer_clear();
  44.  
  45. var i:int = 0;
  46.  
  47. for(i = 0; i < 10; i++){
  48.   AST.timer_start();
  49.   for(var x:int = 0; x < 1000000; x++)
  50.     u = Math.sin(x)+Math.cos(i)+Math.random()/Math.cos(x);
  51.   AST.timer_stop();
  52. }
  53. AST.timer_report();
  54. AST.timer_avg();
  55.  
  56. //timer 2
  57. AST.timer_clear();
  58. for( i = 0; i < 3; i++){
  59.   AST.timer_start();
  60.   for( x = 0; x < 1000; x++)
  61.     u = Math.sin(x)+Math.cos(i)+Math.random()/Math.cos(x);
  62.   AST.timer_stop();
  63. }
  64. AST.timer_report();
  65. AST.timer_avg();
  66.  
  67. // trace stage
  68. // this function is new to AST2
  69. // It gives a tree structure of the displaylist.
  70.  
  71. AST.traceStage();
  72. for(i = 0; i<30; i++)
  73.   addChild( new MovieClip() );
  74.  
  75. AST.traceStage();
  •  
  • 0 Comments
  •  

Your comment

Notify me when someone adds another comment to this post

back

< < November 2009 > >
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

Blog rolls

Latest Comments

Blur Filter
17.01.2011 11:01
ISO FTW!
18.09.2010 20:17
ISO Blender Camera Setup
24.04.2010 06:58
update
21.03.2010 01:15

Archive

  • [-]2010(9)
    • [-]November(1)
    • [-]August(1)
    • [-]July(1)
    • [-]June(2)
    • [-]April(1)
    • [-]March(2)
    • [-]February(1)
  • [-]2009(13)
    • [-]December(4)
    • [-]November(8)
    • [-]October(1)

Copy and paste this link into your RSS news reader

RSS 0.91Posts
RSS 2.0Posts

Social Bookmarking

Bookmark bei: Mr. Wong Bookmark bei: Webnews Bookmark bei: Icio Bookmark bei: Oneview Bookmark bei: Linkarena Bookmark bei: Favoriten Bookmark bei: Seekxl Bookmark bei: Favit Bookmark bei: Social Bookmarking Tool Bookmark bei: Power Oldie Bookmark bei: Bookmarks.cc Bookmark bei: Newskick Bookmark bei: Newsider Bookmark bei: Linksilo Bookmark bei: Readster Bookmark bei: Folkd Bookmark bei: Yigg Bookmark bei: Digg Bookmark bei: Del.icio.us Bookmark bei: Reddit Bookmark bei: Simpy Bookmark bei: StumbleUpon Bookmark bei: Slashdot Bookmark bei: Netscape Bookmark bei: Furl Bookmark bei: Yahoo Bookmark bei: Spurl Bookmark bei: Google Bookmark bei: Blinklist Bookmark bei: Blogmarks Bookmark bei: Diigo Bookmark bei: Technorati Bookmark bei: Newsvine Bookmark bei: Blinkbits Bookmark bei: Ma.Gnolia Bookmark bei: Smarking Bookmark bei: Netvouz Information