Actionscript:
  1. // We need to import the utils package
  2. import flash.utils.*;
  3.  
  4. // Create a new Timer object with a delay of 500 ms
  5. var myTimer:Timer = new Timer(500);
  6. myTimer.addEventListener( TimerEvent.TIMER, timedFunction);
  7.  
  8. // Start the timer
  9. myTimer.start();
  10.  
  11. // Function will be called every 500 milliseconds
  12. function timedFunction(eventArgs:TimerEvent){
  13. trace(”Timer fired ” + myTimer.currentCount + ” times.”);
  14. }