MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 79

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

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. The first
call to
setInterval()
The second call to
setInterval()
as a parameter.
callback2()
function callback1() {
trace("interval called");
}
function callback2(arg) {
trace(arg);
}
setInterval( callback1, 1000 );
setInterval( callback2, 1000, "interval called" );
Usage 3: This example uses a method of an object. You must use this syntax when you want
to call a method that is defined for an object.
obj = new Object();
obj.interval = function() {
trace("interval function called");
}
setInterval( obj, "interval", 1000 );
obj2 = new Object();
obj2.interval = function(s) {
trace(s);
}
setInterval( obj2, "interval", 1000, "interval function called" );
You must use the second form of the
shown in the following example:
setInterval( obj2, "interval", 1000, "interval function called" );
calls the
callback1()
passes the
setInterval()
function, which contains a
"interval called"
syntax to call a method of an object, as
statement.
trace()
string to the function
Global Functions
79

Advertisement

Table of Contents
loading

Table of Contents