MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 153

Actionscript language reference
Table of Contents

Advertisement

extends
Availability
Flash Player 6.
Usage
class className extends otherClassName {}
interface interfaceName extends otherInterfaceName {}
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
Interfaces can also be extended using the
interface includes all 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");
}
function reverse():Void {
trace("[Vehicle] reverse");
}
}
ActionScript Core Language Elements
The name of the class on which
The name of the interface you are defining.
The name of the interface on which
"Creating subclasses" on page
className
interfaceName
55.
keyword. An interface that extends another
extends
CHAPTER 5
is based.
is based.
extends
153

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents