Prototype (Object.prototype Property) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

The following trace statements show that the
the
property of the Circle class.
prototype
trace(Circle.prototype == oneCircle.__proto__); // Output: true
trace(Circle.prototype == twoCircle.__proto__); // Output: true
See also

prototype (Object.prototype property)

prototype (Object.prototype property)
public static prototype :
A reference to the superclass of a class or function object. The
automatically created and attached to any class or function object you create. This property is
static in that it is specific to the class or function you create. For example, if you create a
custom class, the value of the
accessible only as a class property. Instances of your custom class cannot directly access the
property, but can access it through the
prototype
Availability: ActionScript 1.0; Flash Lite 2.0
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 statement shows that the
its superclass Shape. The identifier
trace(Circle.prototype.constructor == Shape); // Output: true
558
ActionScript classes
__proto_
Object
property is shared by all instances of the class, and is
prototype
prototype
refers to the constructor function of the Shape class.
Shape
property of both instances refers to
prototype
property.
__proto__
property of the Circle class points to
property is

Advertisement

Table of Contents
loading

Table of Contents