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

Text-Input Events

Flash Player dispatches text-input events in the following situations:

  • When the user adds new text to an input text field

  • When the user activates an "event:"-protocol hypertext link in a text field (by clicking the link)

  • When a text field is scrolled, either programmatically or by the user

Example 22-4 lists Flash Player's built-in text-input event types. For each type of event, the "Event Type" column lists the 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" column lists Flash Player's native response to the event. The "Bubbles" column indicates whether the event has a bubbling phase. Finally, the "Datatype of object passed to listener function" column specifies the datatype of the object passed to the listener function that handles the event.

Table 22-4. Flash Player text-input events

Event Type

Description

Target

Default behavior

Bubbles

Data Type of Object Passed to Listener Function

TextEvent.TEXT_INPUT

User has attempted to add new text to an input text field.

The TextField object to which the user is attempting to add new text

The text is added to the text field. This default behavior can be canceled via the Event class's instance method preventDefault( ).

Yes

TextEvent

Event.CHANGE

New text added to an input text field by the user.

The TextField ...

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