Conceptually, events can be grouped into two categories:
Actions taken by the user (e.g., a mouseclick or a keystroke)
Things that happen as part of the internal playback of a movie (e.g., a movie clip appearing on stage or a series of variables loading from an external file)
ActionScript does not distinguish syntactically between user events and system events. An event triggered internally by a movie is no less palpable than a user's mouseclick. While we might not normally think of, say, a movie clip's removal from the Stage as a noteworthy "event," being able to react to system events gives us great control over a movie.
ActionScript events may also be categorized more practically according to the object to which they pertain. All events happen relative to some object in the Flash environment. That is, the interpreter doesn't just say "The user clicked"; it says, "The user clicked this button" or "The user clicked while this movie clip was on stage." And the interpreter doesn't say, "Data was received"; it says, "This movie clip received some data." We define the code that responds to events on the objects to which the events relate.
The ActionScript objects that can receive events are:
Movie Clips
Buttons
Objects of the XML and XMLSocket classes
As we'll see throughout this chapter, ActionScript actually has two different event implementations: one for events that relate to movie clips and buttons, and one for all other kinds of objects.
Copyright © 2002 O'Reilly & Associates. All rights reserved.