EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 585

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 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...
onUpdate 585
The following example uses onClipEvent() with the keyDown movie event. The keyDown movie
event is usually used in conjunction with one or more methods and properties of the Key object.
The following script uses
Key.getCode() to find out which key the user has pressed; if the
pressed key matches the
Key.RIGHT property, the movie is sent to the next frame; if the pressed
key matches the
Key.LEFT property, the movie is sent to the previous frame.
onClipEvent(keyDown) {
if (Key.getCode() == Key.RIGHT) {
_parent.nextFrame();
} else if (Key.getCode() == Key.LEFT){
_parent.prevFrame();
}
}
The following example uses onClipEvent() with the mouseMove movie event. The _xmouse and
_
ymouse properties track the position of the mouse each time the mouse moves.
onClipEvent(mouseMove) {
stageX=_root._xmouse;
stageY=_root._ymouse;
}
See also
Key class, MovieClip._xmouse, MovieClip._ymouse, on(), updateAfterEvent()
onUpdate
Availability
Flash Player 6.
Usage
function onUpdate() {
...statements...;
}
Parameters
None.
Returns
Nothing.
Description
Event handler; onUpdate is defined for a Live Preview movie used with a component. When an
instance of a component on the Stage has a Live Preview movie, the authoring tool invokes the
Live Preview movies
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 movie.
Defining an
onUpdate function in a Live Preview movie is optional.
For more information on Live Preview movies, see Using Components.

Table of Contents

Related product manuals