03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Returns<br />

Boolean - A Boolean value: true if the object is in the prototype chain of the object specified<br />

by the theClass parameter; false otherwise.<br />

Object constructor<br />

public Object()<br />

Creates an Object object <strong>and</strong> stores a reference to the object's constructor method in the<br />

object's constructor property.<br />

Example<br />

The following example creates a generic object named myObject:<br />

var myObject:Object = new Object();<br />

__proto__ (Object.__proto__ property)<br />

public __proto__ : Object<br />

Refers to the prototype property of the class (ActionScript 2.0) or constructor function<br />

(ActionScript 1.0) used to create the object. The __proto__ property is automatically<br />

assigned to all objects when they are created. The ActionScript interpreter uses the __proto__<br />

property to access the prototype property of the object's class or constructor function to find<br />

out what properties <strong>and</strong> methods the object inherits from its superclass.<br />

Example<br />

The following example creates a class named Shape <strong>and</strong> a subclass of Shape named Circle.<br />

// Shape class defined in external file named Shape.as<br />

class Shape {<br />

function Shape() {}<br />

}<br />

// Circle class defined in external file named Circle.as<br />

class Circle extends Shape{<br />

function Circle() {}<br />

}<br />

The Circle class can be used to create two instances of Circle:<br />

var oneCircle:Circle = new Circle();<br />

var twoCircle:Circle = new Circle();<br />

The following trace statements show that the __proto_ property of both instances refers to<br />

the prototype property of the Circle class.<br />

trace(Circle.prototype == oneCircle.__proto__); // Output: true<br />

526 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!