User Guide

Controlling time intervals 203
When you run this sample, you should see the following lines appear in your console or trace
window at the rate of one line per second:
tick 1
tick 2
tick 3
tick 4
tick 5
Time's Up!
Timing functions in the flash.utils package
ActionScript 3.0 contains a number of timing functions similar to those that were available in
ActionScript 2.0. These functions are provided as package-level functions in the flash.utils
package, and they operate just as they did in ActionScript 2.0.
These functions remain in ActionScript 3.0 for backward compatibility. Adobe does not
recommend that you use them in new ActionScript 3.0 applications. In general, it is easier
and more efficient to use the Timer class in your applications.
Function Description
clearInterval(id:uint):void
Cancels a specified setInterval() call.
clearTimeout(id:uint):void
Cancels a specified setTimeout() call.
getTimer():int
Returns the number of milliseconds that have
elapsed since the Flash Player was initialized.
setInterval(closure:Function,
delay:Number, ... arguments):uint
Runs a function at a specified interval (in
milliseconds).
setTimeout(closure:Function,
delay:Number, ... arguments):uint
Runs a specified function after a specified delay
(in milliseconds).