Guest User

Untitled

a guest
Jun 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.display.Sprite;
  2. import flash.events.TimerEvent;
  3. import flash.utils.Timer;
  4. import flash.Lib;
  5.  
  6. class Main extends Sprite
  7. {
  8.     var t:Timer;
  9.     var i:Int;
  10.     public static function main()
  11.     {
  12.         #if flash
  13.         new Main();
  14.         #else
  15.         Lib.create(function(){new Main();},800,600,1,0xccccff,(1*Lib.HARDWARE) | Lib.RESIZABLE);
  16.         #end
  17.     }
  18.     public function new()
  19.     {
  20.         super();
  21.         Lib.current.addChild(this);
  22.         i=0;
  23.         t = new Timer(500);
  24.         t.addEventListener(TimerEvent.TIMER, onTimer);
  25.         t.start();
  26.     }
  27.     function onTimer (event:TimerEvent):Void
  28.     {
  29.         i++;
  30.         trace(i);
  31.     }
  32. }
Add Comment
Please, Sign In to add comment