MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 99

Actionscript 2.0 language reference
Table of Contents

Advertisement

"powder blue",
"mint");
function executeCallback(param:String) {
trace("executeCallback intervalId: " + intervalId + " count: " + count + "
param: " + param);
clearInterval(intervalId);
if(count < maxCount) {
count++;
intervalId = setInterval(this, "executeCallback", duration,
colors[count]);
}
}
if(intervalId != null) {
clearInterval(intervalId);
}
intervalId = setInterval(this, "executeCallback", duration, colors[count]);
Example 4: The following example shows how to use
ActionScript 2.0 custom class. Note that similar to previous examples,
function to ensure that the called method is executed within the correct
setInterval()
scope.
class CustomClass {
private var intervalId:Number;
private var count:Number = 0;
private var maxCount:Number = 10;
private var duration:Number = 20;
public function CustomClass():Void {
beginInterval();
}
private function beginInterval():Void {
if(intervalId != null) {
trace("clearInterval");
clearInterval(intervalId);
}
intervalId = setInterval(this, "executeCallback", duration);
}
public function executeCallback():Void {
trace("executeCallback intervalId: " + intervalId + " count: " + count);
if(count >= maxCount) {
clearInterval(intervalId);
}
correctly from an
setInterval()
this
Global Functions
is passed to the
99

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF