
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
5
setAttributes(Constants, "MEGA", null, true, true);
Constants.GIGA = 1000*Constants.MEGA; setAttributes(Constants, "GIGA", null, true, true);
setInterval()
setInterval(function, interval[, p1, ..., pN])
setInterval(object.method, interval[, p1, ..., pN])
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 routine. The
setInterval() method returns a unique ID that you can pass to
the
clearInterval() method to stop the routine.
Note: Standard JavaScript supports an additional usage for the
setInterval() method,
setInterval(stringToEvaluate, timeInterval), which is not supported by Server-Side ActionScript.
Availability
Flash Communication Server 1
Parameters
function A Function object.
object.method A method to call on object.
interval A number indicating the time in milliseconds between calls to function.
p1, ..., pN Optional parameters passed to function.
Returns
An integer that provides a unique ID for this call. If the interval is not set, returns -1.
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");
The following example uses a named function, callback1(), to send the message “interval called” to the
server log:
function callback1(){trace("interval called"); }
setInterval(callback1, 1000);
The following example also uses a named function, callback2(), to send the message “interval called” to the
server log, but it passes the message to the function as a parameter:
function callback2(s){
trace(s);
}
setInterval(callback2, 1000, "interval called");
The following example uses the second syntax:
var a = new Object();
a.displaying=displaying;
setInterval(a.displaying, 3000);
Kommentare zu diesen Handbüchern