We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

chrisaiv on 01/14/08


Tagged

as3


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

arala22
outbox


AS3: Basic Timer example


Published in: ActionScript 3 


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.


  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 

You need to login to post a comment.