O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Keyboard-Input Events

Flash Player dispatches keyboard-input events when the user presses or releases the keys on a keyboard. Broadly speaking, keyboard input events are typically used to trigger a response from either the application as a whole or from a specific interface element. For example, pressing the "S" key might trigger a global "save user data" command while pressing the Down Arrow key might select an item in a specific menu component.

Keyboard-input events that trigger application-wide commands are typically handled globally, by listeners registered with Flash Player's Stage instance. By contrast, keyboard-input events that trigger a specific interface-element response are typically handled by listeners registered with the object that currently has keyboard focus.

Warning

Flash Player's keyboard-input events are intended for use when developing keyboard-controlled applications but are not suitable for responding to textual input in TextField objects. To respond to textual input, use the TextEvent.TEXT_INPUT event, described later in the section "Text-Input Events."

Example 22-3 lists Flash Player's built-in keyboard-event types. For each type of event, the "Event type" column lists the KeyboardEvent-class constant that indicates the event type's official string name. The "Description" column describes the specific user action that triggers the event. The "Target" column lists the object that serves as the event target when the event is dispatched. The "Default behavior" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required