EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Addproperty (Object.addproperty Method)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Object 551
addProperty (Object.addProperty method)
public addProperty(name:String, getter:Function, setter:Function) : Boolean
Creates a getter/setter property. When Flash reads a getter/setter property, it invokes the get
function, and the function's return value becomes the value of
name. When Flash writes a
getter/setter property, it invokes the
set function and passes it the new value as a parameter. If
a property with the given name already exists, the new property overwrites it.
A "get" function is a function with no parameters. Its return value can be of any type. Its type
can change between invocations. The return value is treated as the current value of the
property.
A "set" function is a function that takes one parameter, which is the new value of the property.
For example, if property
x is assigned by the statement x = 1, the set function is passed the
parameter
1 of type number. The return value of the set function is ignored.
You can add getter/setter properties to prototype objects. If you add a getter/setter property to
a prototype object, all object instances that inherit the prototype object inherit the getter/
setter property. This makes it possible to add a getter/setter property in one location, the
prototype object, and have it propagate to all instances of a class (similar to adding methods to
prototype objects). If a get/set function is invoked for a getter/setter property in an inherited
prototype object, the reference passed to the get/set function is the originally referenced
object--not the prototype object.
isPrototypeOf(theClass:Object) :
Boolean
Indicates whether an instance of the
Object class is in the prototype
chain of the object specified as an
argument.
static registerClass(name:String,
theClass:Function) : Boolean
Associates a movie clip symbol with
an ActionScript object class.
toString() : String Converts the specified object to a
string and returns it.
unwatch(name:String) : Boolean Removes a watchpoint that
Object.watch() created.
valueOf() : Object Returns the primitive value of the
specified object.
watch(name:String,
callback:Function,
[userData:Object]) : Boolean
Registers an event handler to be
invoked when a specified property
of an ActionScript object changes.
Modifiers Signature Description

Table of Contents

Related product manuals