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

className The name of the class you are defining.

otherClassName The name of the class on which className is based.

interfaceName The name of the interface you are defining.

otherInterfaceName The name of the interface on which interfaceName is based.

Description

Keyword; defines a class or interface that is a subclass of another class or interface; 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.

Example

In class B as defined below, a call to class A's constructor will automatically be inserted as the first statement of B's constructor function, because a call does not already exist there. (That is, it is commented out in the example.)

class B extends class A
{
  function B() { // this is the constructor
//    super(); // optional; inserted during compilation if omitted
  }
  function m():Number {return 25;}
  function o(s:String):Void {trace(s);}
} 

See also

class, implements, interface