start page | rating of books | rating of authors | reviews | copyrights

Book HomeActionScript: The Definitive GuideSearch this book

10.9. Movie Clip Events Overview

Movie clip events are generated by a wide variety of occurrences in the Flash Player, from mouseclicks to the downloading of data. Clip events can be broken into two categories: user-input events and movie-playback events. User-input events are related to the mouse and keyboard, while movie-playback events are related to the rendering of frames in the Flash Player, the birth and death of movie clips, and the loading of data.

Note that user-input clip events partially overlap the functionality of the button events described earlier. For example, a clip's mouseDown event handler can detect a mouse press just as a button's press event handler can. Movie clip events, however, are not tied to any kind of hit area like button events are and do not affect the look of the mouse pointer.

Let's spend some quality time with the ActionScript movie clip events, summarized in Table 10-2. We'll look at the movie-playback events first (enterFrame, load, unload, and data) and then see how the user-input events work (mouseDown, mouseUp, mouseMove, keyDown, keyUp). Each of the clip events is handled by a matching clip event handler of the form onClipEvent (eventName). For example, the enterFrame event is handled using an event handler beginning with onClipEvent (enterFrame). With the exception of load, unload, and data, movie clip events are sent to all movie clips on stage even if, say, the user clicks the mouse while on top of a different movie clip (or no movie clip).

Table 10-2. Movie Clip Events

Clip Event Name

Clip Event Occurs When . . .

enterFrame

Playhead enters a frame (before frame is rendered in the Flash Player)

load

The clip first appears on the Stage

unload

The clip is removed from the Stage

data

Variables finish loading into a clip or a portion of a loaded movie loads into a clip

mouseDown

Primary mouse button is depressed while the clip is on stage (secondary mouse buttons are not detectable)

mouseUp

Primary mouse button is released while the clip is on stage

mouseMove

Mouse pointer moves (even a teensy bit) while the clip is on Stage, even if the mouse is not over the clip

keyDown

A key is pressed down while the clip is on Stage

keyUp

A depressed key is released while the clip is on Stage



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.