Super Statement - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example demonstrates how you can use the
counter that tracks how many instances of the class have been created. Because the
variable is static, it will be created only once for the entire class, not for every
numInstances
single instance. Create a new AS file called Users.as and enter the following code:
class Users {
private static var numInstances:Number = 0;
function Users() {
numInstances++;
}
static function get instances():Number {
return numInstances;
}
}
Create a FLA or AS document in the same directory, and enter the following ActionScript in
Frame 1 of the Timeline:
trace(Users.instances);
var user1:Users = new Users();
trace(Users.instances);
var user2:Users = new Users();
trace(Users.instances);
See also
private statement

super statement

super.method([arg1, ..., argN])
super([arg1, ..., argN])
the first syntax style may be used within the body of an object method to invoke the
superclass version of a method, and can optionally pass parameters
superclass method. This is useful for creating subclass methods that add additional behavior
to superclass methods, but also invoke the superclass methods to perform their original
behavior.
The second syntax style may be used within the body of a constructor function to invoke the
superclass version of the constructor function and may optionally pass it parameters. This is
useful for creating a subclass that performs additional initialization, but also invokes the
superclass constructor to perform superclass initialization.
Availability: ActionScript 1.0; Flash Player 6
keyword to create a
static
(arg1 ... argN)
Statements
to the
227

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF