extends
Availability
Flash Player 6.
Usage
class className extends otherClassName {}
interface interfaceName extends otherInterfaceName {}
Note: To use this keyword, you must specify ActionScript 2.0 and Flash Player 6 or later in the Flash
tab of your FLA file's Publish Settings dialog box. This keyword is supported only when used in
external script files, not in scripts written in the Actions panel.
Parameters
The name of the class you are defining.
className
otherClassName
interfaceName
otherInterfaceName
Description
Keyword; defines a class that is a subclass of another class; the latter is the superclass. The subclass
inherits all the methods, properties, functions, and so on that are defined in the superclass.
For more information, see "Creating subclasses" in Using ActionScript in Flash.Interfaces can also
be extended using the
the original interface's method declarations.
Example
In the following example, the Car class extends the Vehicle class so that all its methods, properties,
and functions are inherited. If your script instantiates a Car object, methods from both the Car
class and the Vehicle class can be used.
The following example shows the contents of a file called Vehicle.as, which defines the Vehicle
class:
class Vehicle {
var numDoors:Number;
var color:String;
function Vehicle(param_numDoors:Number, param_color:String) {
this.numDoors = param_numDoors;
this.color = param_color;
}
function start():Void {
trace("[Vehicle] start");
}
function stop():Void {
trace("[Vehicle] stop");
}
}
ActionScript Language Reference
The name of the class on which
The name of the interface you are defining.
The name of the interface on which
keyword. An interface that extends another interface includes all
extends
is based.
className
interfaceName
CHAPTER 2
is based.
extends
297
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers