setInterval()
Availability
Flash Player 6.
Usage
setInterval(functionName, interval [, param1, param2, ..., paramN])
Parameters
functionName
The time in milliseconds between calls to the
interval
param1, param2, ..., paramN
parameter.
methodName
Returns
An interval identifier that you can pass to
Description
Function; calls a function or a method or an object at periodic intervals while a SWF file plays.
You can use an interval function to update variables from a database or update a time display.
If
is less than the SWF file's frame rate (for example, 10 frames per second [fps] is equal
interval
to 100 milliseconds), the interval function is called as close to
the
updateAfterEvent()
is greater than the SWF file's frame rate, the interval function is only called each time
interval
the playhead enters a frame; this minimizes the impact each time the screen is refreshed.
Example
Usage 1:The following example calls an anonymous function every 1000 milliseconds (every
1 second).
setInterval( function(){ trace("interval called"); }, 1000 );
Usage 2: The following example defines two event handlers and calls each of them. Both calls to
setInterval()
milliseconds. The first call to
action. The second call to
trace()
function
callback2()
function callback1() {
trace("interval called");
}
function callback2(arg) {
trace(arg);
}
setInterval( callback1, 1000 );
setInterval( callback2, 1000, "interval called" );
A function name or a reference to an anonymous function.
Optional parameters passed to the
function to make sure that the screen refreshes often enough. If
send the string
"interval called"
setInterval()
setInterval()
as a parameter.
functionName
to cancel the interval.
clearInterval()
interval
to the Output panel every 1000
calls the
callback1()
passes the
"interval called"
parameter.
or
function
as possible. You must use
function, which contains a
string to the
setInterval()
615
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?