onUpdate
665
onUpdate
Availability
Flash Player 6.
Usage
function onUpdate() {
...statements...;
}
Parameters
None.
Returns
Nothing.
Description
Event handler;
onUpdate
is defined for a Live Preview used with a component. When an instance
of a component on the Stage has a Live Preview, the authoring tool invokes the Live Preview’s
onUpdate
function whenever the component parameters of the component instance change. The
onUpdate
function is invoked by the authoring tool with no parameters, and its return value is
ignored. The
onUpdate
function should be declared on the main Timeline of the Live Preview.
Defining an
onUpdate
function in a Live Preview is optional.
For more information on Live Preview, see
Using Components
.
Example
The
onUpdate
function gives the Live Preview an opportunity to update its visual appearance to
match the new values of the component parameters. When the user changes a parameter value in
the components Property inspector or Parameters tab in the Components inspector,
onUpdate
is
invoked. The
onUpdate
function does something to update itself. For instance, if the component
includes a
color
parameter, the
onUpdate
function might alter the color of a movie clip inside
the Live Preview to reflect the new parameter value. In addition, it might store the new color in
an internal variable.
The following example uses the
onUpdate
function to pass parameter values through an empty
movie clip in the Live Preview. To see this code work, place a labeled button component on the
Stage with a variable labelColor that specifies the color of the text label. The following code is in
the first frame of the main Timeline of the component:
/* Define the textColor parameter variable to specify the color of the button
label text.*/
buttonLabel.textColor = labelColor;
In the Live Preview, place an empty movie clip named
xch
in the Live Preview. Then place the
following code in the first frame of the Live Preview. Add
"xch"
to the
labelColor
variable path
to pass the variable through the
my_mc
movie clip:
//Write an onUpdate function, adding "my_mc." to the parameter variable names:
function onUpdate (){
buttonLabel.textColor = my_mc.labelColor;
}
CHAPTER 7
ActionScript for Flash
Содержание FLEX
Страница 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 ...