
998
ActionScript classes
__proto__ (Object.__proto__ property)
public __proto__ : Object
Refers to the
prototype
property of the class (ActionScript 2.0) or constructor function
(ActionScript 1.0) used to create the object. The
__proto__
property is automatically
assigned to all objects when they are created. The ActionScript interpreter uses the
__proto__
property to access the
prototype
property of the object's class or constructor function to find
out what properties and methods the object inherits from its superclass.
Availability:
ActionScript 1.0; Flash Player 5
Example
The following example creates a class named Shape and a subclass of Shape named Circle.
// Shape class defined in external file named Shape.as
class Shape {
function Shape() {}
}
// Circle class defined in external file named Circle.as
class Circle extends Shape{
function Circle() {}
}
The Circle class can be used to create two instances of Circle:
var oneCircle:Circle = new Circle();
var twoCircle:Circle = new Circle();
The following trace statements show that the
__proto_
property of both instances refers to
the
prototype
property of the Circle class.
trace(Circle.prototype == oneCircle.__proto__); // Output: true
trace(Circle.prototype == twoCircle.__proto__); // Output: true
See also
prototype (Object.prototype property)
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...