
Object.hasOwnProperty() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
723
// Add the property.
MovieClip.prototype.addProperty("depth",
MovieClip.prototype.getDepth,
MovieClip.prototype.swapDepths);
// Try it out. Note that swapDepths() can accept either a number or a target clip.
this.createEmptyMovieClip("empty_mc", 15);
trace(empty_mc.depth); // Displays: 15
empty_mc.depth = 20; // Pass an integer to swapDepths(). Depth becomes 20.
trace(empty_mc.depth); // Displays: 20
empty_mc.depth = ball_mc; // Trade depths with ball_mc (passed to swapDepths())
See Also
MovieClip.getDepth(), MovieClip.swapDepths(), Object.__proto__, Object.watch();
Chapter 12
Object.constructor Property
a reference to the class constructor function used to create the object
Flash 5
read/write
someObject.constructor
Description
The constructor property stores a reference to the constructor function that was used to
create
someObject. For example, the constructor property of a Date object is the Date
constructor function:
now = new Date();
now.constructor = = Date; // Yields true
Note that in JavaScript, the constructor property is always read from someObject’s
constructor’s
prototype property (someObject.__proto__.constructor). In Flash Player 6
and Flash Player 5, the
constructor property is written directly to someObject so that ...