There are now new ways to produce old results. In older versions of ActionScript, one would use the setInterval() function. Now, as actionscript 3 serves as the community model citizen of OOP (Object Oriented Programming) we are given the new Timer class in the flash.utils package.
The Class constructor
package { import flash.utils.Timer; import flash.events.TimerEvent; import flash.display.Sprite; public class TimerExample extends Sprite { public function TimerExample() { var myTimer:Timer = new Timer(1000, 2); myTimer.addEventListener("timer", timerHandler); myTimer.start(); } public function timerHandler(event:TimerEvent):void { trace("timerHandler: " + event); } } }
This example showsthe creation of the event listener and timerHandler function which performs the action, in this case, a trace.Give it a try.The timer class is one of the most useful classes in creating sites which can create interactivity without timelines.