AS3: Basic Timer example


/ Published in: ActionScript 3
Save to your folder(s)

Flash's Timer Class requires two parameters. The first is the delay (in milliseconds), the second is the amount of times you want the delay to fire.


Copy this code and paste it in your HTML
  1. var timer:Timer = new Timer(1000, 2);
  2. timer.addEventListener(TimerEvent.TIMER, blah);
  3. timer.start();
  4.  
  5. function blah(e:TimerEvent):void{
  6. trace("Times Fired: " + e.currentTarget.currentCount);
  7. trace("Time Delayed: " + e.currentTarget.delay);
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.