MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 203

Actionscript language reference
Table of Contents

Advertisement

setInterval()
Availability
Flash Player 6.
Usage
setInterval(functionName:Function, interval:Number [, param1:Object, param2,
..., paramN]) : Number
setInterval(objectName:Object, methodName:Function, interval:Number [,
param1:Object, param2, ..., paramN]) : Number
Parameters
functionName
The time in milliseconds between calls to the
interval
parameter.
param1, param2, ..., paramN
parameter.
methodName
An object containing the method
objectName
when using setInterval() in an
A method of
methodName
Returns
An identifying integer 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 to update a time display.
Example
Usage 1: The following example calls an anonymous function every 1000 milliseconds
(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()
first call to
setInterval()
statement. The second call to
function
callback2()
function callback1() {
trace("interval called");
}
function callback2(arg) {
trace(arg);
}
ActionScript Core Language Elements
A function name or a reference to an anonymous function.
Optional parameters passed to the
<mx:Script>
objectName
send the string
"interval called"
calls the
callback1()
setInterval()
as a parameter.
functionName
. You must include this parameter
methodName
block in Flex applications.
.
to cancel the interval.
clearInterval()
to the log file every 1000 milliseconds.The
function, which contains a
passes the
"interval called"
CHAPTER 5
or
methodName
or
functionName
trace()
string to the
setInterval()
203

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents