
582
Chapter 12: ActionScript Dictionary
Example
This example shows a CheckBox component with methods that set the label or value of each
check box instance:
myCheckBox1.setValue(true);
myCheckBox1.setLabel("new label");
...
It’s convenient to think of the value and label of a check box as properties. It’s possible to use
Object.watch()
to make accessing the value and label look like property access rather than
method invocation, as in the following:
// Define constructor for (and thus define) CheckBox class
function CheckBox() {
...
this.watch('value', function (id, oldval, newval){
...
});
this.watch('label', function(id, oldval, newval){
...
});
}
When the value or label property is modified, the function specified by the component is invoked
to perform any tasks needed to update the appearance and state of the component. The following
example invokes an
Object.watch()
method to notify the component that the variable has
changed, causing the component to update its graphical representation.
myCheckBox1.value = false;
This syntax is more concise than the former syntax:
myCheckBox1.setValue(false);
See also
Object.addProperty()
,
Object.unwatch()
Object()
Availability
Flash Player 5 .
Usage
Object( [
value
] )
Parameters
value
A number, string, or Boolean value.
Returns
An object.
Description
Conversion function; creates a new, empty object or converts the specified number, string, or
Boolean value to an object. This command is equivalent to creating an object using the Object
constructor (see
“Constructor for the Object class” on page 575
).
Содержание FLASH MX 2004 - ACTIONSCRIPT
Страница 1: ...ActionScript Reference Guide...
Страница 8: ...8 Contents...
Страница 12: ......
Страница 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Страница 54: ...54 Chapter 2 ActionScript Basics...
Страница 80: ...80 Chapter 3 Writing and Debugging Scripts...
Страница 82: ......
Страница 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Страница 112: ......
Страница 120: ...120 Chapter 6 Using the Built In Classes...
Страница 176: ......
Страница 192: ...192 Chapter 10 Working with External Data...
Страница 202: ...202 Chapter 11 Working with External Media...
Страница 204: ......
Страница 782: ...782 Chapter 12 ActionScript Dictionary...
Страница 793: ...Other keys 793 221 222 Key Key code...
Страница 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Страница 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Страница 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Страница 816: ...816 Index...