class org.aswing.util.Timer extends AbstractImpulser
Fires one or more action events after a specified delay.
For example, an animation object can use a Timer
as the trigger for drawing its frames.
Setting up a timer
involves creating a Timer
object,
registering one or more action listeners on it,
and starting the timer using
the start
method.
For example,
the following code creates and starts a timer
that fires an action event once per second
(as specified by the first argument to the Timer
constructor).
The second argument to the Timer
constructor
specifies a listener to receive the timer's action events.
var delay:Number = 1000; //milliseconds var listener:Object = new Object(); listener.taskPerformer = function(e:Event) { //...Perform a task... } var timer:Timer = new Timer(delay); timer.addActionListener(listener.taskPerformer); timer.start();
@author paling
Instance Fields
Show inherited public instance fields | Hide inherited public instance fields
|