
Object.valueOf() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
731
// Make the Ball constructor
function Ball (radius, color, xPosition, yPosition) {
this.radius = radius;
this.color = color;
this.xPosition = xPosition;
this.yPosition = yPosition;
}
// Add a custom toString() method
Ball.prototype.toString = function () {
return "A ball with the radius " + this.radius;
};
// Create a new Ball object
myBall = new Ball(6, 0x00FF00, 145, 200);
// Now check myBall's string value
trace(myBall); // Displays: "A ball with the radius 6"
See Also
Array.toString(), Date.toString(), Number.toString(), Object.valueOf()
Object.unwatch() Method
remove an existing watchpoint
Flash 6
someObject.unwatch(prop)
Arguments
prop A string indicating the name of the property that should no longer be
watched. The name must adhere to the rules for creating an identifier
outlined under “Identifiers” in Chapter 15.
Returns
A Boolean indicating whether prop was previously being watched; true if prop exists and
was previously being watched;
false otherwise.
Description
The unwatch() method removes a watchpoint previously set on prop via the Object.watch()
method. Once the watchpoint is removed, value assignments to
prop will no longer be
moderated by the watch() callback function. Note that a watchpoint can be removed only
via Object.unwatch( ...