Flash MX introduced the setInterval
function that can be used to time function or method invocations.
Building upon that feature, we have created two types of timers,
a basic countdown timer (FISTimer,
with optional looping), and a stopwatch (FISStopwatch).
The FISTimer countdown
timer can be programmed or set via the component parameter value
to a specific interval (in milliseconds). The developer can indicate
how many times to repeat the countdown. When the time elapses, the
component generates an event called EndTime
(the name can be changed programmatically or through the parameter
panel). The timer is controlled by two methods, start()
and reset(). As their
name suggests, start()
activates the timer. The reset()
method halts the timer, if active, and sets it to begin looping
once the start()
method is called.
The FISStopwatch
keeps track of elapsed time and can be told to generate pulses (default
event name is SWPulse)
at a specified frequency when the counting is active. The component
is controlled by three methods, start(),
reset(), and pause().
The first two methods act the same as the FISTimer,
with reset() setting
the stopwatch to 0. The pause()
method temporarily suspends the counting, until start()
is invoked to start the stopwatch, or reset()
is invoked to set it back to 0.
|