Chapter 22. Interactivity

In this chapter, we’ll see how to add interactivity to an application by responding to Flash Player’s input events. Specifically, we’ll explore five different categories of input events:

  • Mouse events

  • Focus events

  • Keyboard events

  • Text events

  • Flash Player-level events

For each of the preceding event categories, we’ll consider the specific events offered by Flash Player’s API and the code required to handle those events.

The descriptions of the events covered in this chapter apply specifically to Flash Player (both the browser add-on and standalone versions) but are also generally applicable to any Flash runtime that supports mouse and keyboard input (such as Adobe AIR). When working with other Flash runtimes, be sure to consult the appropriate documentation for information on input events. For official reference material covering Flash Player’s input events, see Adobe’s ActionScript Language Reference under the Constants heading of the Event class and its subclasses. Also see the Events heading under the TextField, DisplayObject, InteractiveObject, and Stage classes.

Before we start our examination of specific input events, let’s take a quick look at some general rules that govern all input events:

InteractiveObject instances only

Input-event notifications are sent to instances of classes that inherit from InteractiveObject only (Sprite, TextField, Stage, Loader, MovieClip, SimpleButton and subclasses of those classes.) Other types of objects are not notified of input ...

Get Essential ActionScript 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.