User Guide
setInterval() 115
setInterval()
Availability
Flash Communication Server MX 1.0.
Usage
setInterval(function, interval[, p1, ..., pN])
setInterval(object, methodName, interval[, p1, ..., pN])
Parameters
function The name of a defined ActionScript function or a reference to an anonymous
function.
object An object derived from the ActionScript Object object.
methodName The name of the method to call on object.
interval The time (interval) between calls to function, in milliseconds.
p1, ..., pN Optional parameters passed to function.
Returns
A unique ID for this call. If the interval is not set, the method returns -1.
Description
Method (global); continually calls a function or method at a specified time interval until the
clearInterval() method is called. This method allows a server-side script to run a generic
routine. The
setInterval method returns a unique ID that you can pass to the
clearInterval() method to stop the routine.
Example
The following example uses an anonymous function to send the message “interval called” to
the server log every second:
setInterval(function(){trace("interval called");}, 1000);
The following example also uses an anonymous function to send the message “interval called”
to the server log every second, but it passes the message to the function as a parameter:
setInterval(function(s){trace(s);}, 1000, "interval called");
NOTE
Standard JavaScript supports an additional usage for the setInterval() method,
setInterval(stringToEvaluate, timeInterval), which is not supported by server-side
ActionScript.