MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 665

Actionscript language reference
Table of Contents

Advertisement

onUpdate
Availability
Flash Player 6.
Usage
function onUpdate() {
...statements...;
}
Parameters
None.
Returns
Nothing.
Description
Event handler;
onUpdate
of a component on the Stage has a Live Preview, the authoring tool invokes the Live Preview's
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
onUpdate
ignored. The
onUpdate
Defining an
onUpdate
For more information on Live Preview, see Using Components.
Example
The
function gives the Live Preview an opportunity to update its visual appearance to
onUpdate
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,
invoked. The
onUpdate
includes a
color
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
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
following code in the first frame of the Live Preview. Add
to pass the variable through the
//Write an onUpdate function, adding "my_mc." to the parameter variable names:
function onUpdate (){
buttonLabel.textColor = my_mc.labelColor;
}
is defined for a Live Preview used with a component. When an instance
function should be declared on the main Timeline of the Live Preview.
function in a Live Preview is optional.
function does something to update itself. For instance, if the component
parameter, the
onUpdate
onUpdate
movie clip:
my_mc
function might alter the color of a movie clip inside
function to pass parameter values through an empty
in the Live Preview. Then place the
xch
to the
"xch"
CHAPTER 7
ActionScript for Flash
onUpdate
variable path
labelColor
onUpdate
is
665

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents