- The function that is invoked to set the value of the property; this
setter:Function
parameter is a Function object. If you pass the value
read-only.
Returns
- A Boolean value:
Boolean
Example
In the following example, an object has two internal methods,
. A property,
getQuantity()
either set or retrieved. A third internal method,
associated with the property
, the ActionScript interpreter automatically invokes
myBook.bookcount
myBook.getQuantity()
interpreter invokes
myObject.setQuantity()
function, so attempts to modify
set
function Book() {
this.setQuantity = function(numBooks:Number):Void {
this.books = numBooks;
};
this.getQuantity = function():Number {
return this.books;
};
this.getTitle = function():String {
return "Catcher in the Rye";
};
this.addProperty("bookcount", this.getQuantity, this.setQuantity);
this.addProperty("bookname", this.getTitle, null);
}
var myBook = new Book();
myBook.bookcount = 5;
trace("You ordered "+myBook.bookcount+" copies of "+myBook.bookname);
// output: You ordered 5 copies of Catcher in the Rye
if the property is successfully created;
true
, can be used to invoke these methods when it is
bookcount
. When a script retrieves the value of
bookname
. When a script modifies the value of
bookname
for this parameter, the property is
null
setQuantity()
, returns a read-only value that is
getTitle()
myBook.bookcount
. The
property does not specify a
bookname
are ignored.
otherwise.
false
and
, the
Object
993
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?