MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference page 733

Actionscript language reference
Table of Contents

Advertisement

If you work with
setInterval()
when you call the function. The
if you do not use the keyword. This is illustrated in the following example. For a FLA file with a
button called
deleteUser_btn,
var me:User = new User("Gary");
this.deleteUser_btn.onRelease = function() {
trace("Goodbye, "+me.username);
delete me;
};
Then create a FLA in the same directory called User.as. Enter the following ActionScript:
class User {
var intervalID:Number;
var username:String;
function User(param_username:String) {
trace("Welcome, "+param_username);
this.username = param_username;
this.intervalID = setInterval(this, "traceUsername", 1000, this.username);
}
function traceUsername(str:String) {
trace(this.username+" is "+getTimer()/1000+" seconds old, happy
birthday.");
}
}
See also
clearInterval(), updateAfterEvent()
within classes, you need to be sure to use the
function does not have access to class members
setInterval()
add the following ActionScript to Frame 1:
keyword
this
setInterval()
733

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flash mx

Table of Contents