Object.addProperty()
377
Returns
A reference to an Object object.
Description
Constructor; creates an Object object and stores a reference to the object’s constructor method in
the object’s
constructor
property.
Example
The following example creates a generic object named myObject:
var myObject:Object = new Object();
Object.addProperty()
Availability
Flash Player 6. In ActionScript 2.0 classes, you can use
get
or
set
instead of this method.
Usage
myObject
.addProperty(
prop:String
,
getFunc:Function
,
setFunc:Function
)
:
Boolean
Parameters
prop
A string; the name of the object property to create.
getFunc
The function that is invoked to retrieve the value of the property; this parameter is a
Function object.
setFunc
The function that is invoked to set the value of the property; this parameter is a
Function object. If you pass the value
null
for this parameter, the property is read-only.
Returns
A Boolean value:
true
if the property is successfully created;
false
otherwise.
Description
Method; 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
prop
. 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.
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...