Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextEvent

An object dispatches a TextEvent object when a user enters text in a text field or clicks a hyperlink in an HTML-enabled text field. There are two types of text events: TextEvent.LINK and TextEvent.TEXT_INPUT.

Hierarchy

Index

Constructors

constructor

  • new TextEvent(type: string, bubbles?: boolean, cancelable?: boolean, text?: string): TextEvent
  • Creates an Event object that contains information about text events. Event objects are passed as parameters to event listeners.

    Parameters

    • type: string

      The type of the event. Event listeners can access this information through the inherited type property. Possible values are: TextEvent.LINK and TextEvent.TEXT_INPUT.

    • Optional bubbles: boolean

      Determines whether the Event object participates in the bubbling phase of the event flow. Event listeners can access this information through the inherited bubbles property.

    • Optional cancelable: boolean

      Determines whether the Event object can be canceled. Event listeners can access this information through the inherited cancelable property.

    • Optional text: string

      One or more characters of text entered by the user. Event listeners can access this information through the text property.

    Returns TextEvent

Properties

bubbles

bubbles: boolean

Indicates whether an event is a bubbling event. If the event can bubble, this value is true; otherwise it is false.

When an event occurs, it moves through the three phases of the event flow: the capture phase, which flows from the top of the display list hierarchy to the node just before the target node; the target phase, which comprises the target node; and the bubbling phase, which flows from the node subsequent to the target node back up the display list hierarchy.

Some events, such as the activate and unload events, do not have a bubbling phase. The bubbles property has a value of false for events that do not have a bubbling phase.

cancelable

cancelable: boolean

Indicates whether the behavior associated with the event can be prevented. If the behavior can be canceled, this value is true; otherwise it is false.

currentTarget

currentTarget: any

The object that is actively processing the Event object with an event listener. For example, if a user clicks an OK button, the current target could be the node containing that button or one of its ancestors that has registered an event listener for that event.

eventPhase

eventPhase: EventPhase

The current phase in the event flow. This property can contain the following numeric values:

  • The capture phase(EventPhase.CAPTURING_PHASE).
  • The target phase(EventPhase.AT_TARGET).
  • The bubbling phase(EventPhase.BUBBLING_PHASE).

target

target: any

The event target. This property contains the target node. For example, if a user clicks an OK button, the target node is the display list node containing that button.

text

text: string

For a textInput event, the character or sequence of characters entered by the user. For a link event, the text of the event attribute of the href attribute of the <a> tag.

type

type: string

The type of event. The type is case-sensitive.

Static ACTIVATE

ACTIVATE: string

The ACTIVATE constant defines the value of the type property of an activate event object.

Note: This event has neither a "capture phase" nor a "bubble phase", which means that event listeners must be added directly to any potential targets, whether the target is on the display list or not.

AIR for TV devices never automatically dispatch this event. You can, however, dispatch it manually.

This event has the following properties:

Static ADDED

ADDED: string

The Event.ADDED constant defines the value of the type property of an added event object.

This event has the following properties:

Static ADDED_TO_STAGE

ADDED_TO_STAGE: string

The Event.ADDED_TO_STAGE constant defines the value of the type property of an addedToStage event object.

This event has the following properties:

Static CANCEL

CANCEL: string

The Event.CANCEL constant defines the value of the type property of a cancel event object.

This event has the following properties:

Static CHANGE

CHANGE: string

The Event.CHANGE constant defines the value of the type property of a change event object.

This event has the following properties:

Static CLEAR

CLEAR: string

Static CLOSE

CLOSE: string

The Event.CLOSE constant defines the value of the type property of a close event object.

This event has the following properties:

Static COMPLETE

COMPLETE: string

The Event.COMPLETE constant defines the value of the type property of a complete event object.

This event has the following properties:

Static CONNECT

CONNECT: string

The Event.CONNECT constant defines the value of the type property of a connect event object.

This event has the following properties:

Static CONTEXT3D_CREATE

CONTEXT3D_CREATE: string

Static COPY

COPY: string

Static CUT

CUT: string

Static DEACTIVATE

DEACTIVATE: string

The Event.DEACTIVATE constant defines the value of the type property of a deactivate event object.

Note: This event has neither a "capture phase" nor a "bubble phase", which means that event listeners must be added directly to any potential targets, whether the target is on the display list or not.

AIR for TV devices never automatically dispatch this event. You can, however, dispatch it manually.

This event has the following properties:

Static ENTER_FRAME

ENTER_FRAME: string

The Event.ENTER_FRAME constant defines the value of the type property of an enterFrame event object.

Note: This event has neither a "capture phase" nor a "bubble phase", which means that event listeners must be added directly to any potential targets, whether the target is on the display list or not.

This event has the following properties:

Static EXIT_FRAME

EXIT_FRAME: string

Static FRAME_CONSTRUCTED

FRAME_CONSTRUCTED: string

Static FRAME_LABEL

FRAME_LABEL: string

Static FULLSCREEN

FULLSCREEN: string

Static ID3

ID3: string

The Event.ID3 constant defines the value of the type property of an id3 event object.

This event has the following properties:

Static INIT

INIT: string

The Event.INIT constant defines the value of the type property of an init event object.

This event has the following properties:

Static LINK

LINK: string

Defines the value of the type property of a link event object.

This event has the following properties:

Static MOUSE_LEAVE

MOUSE_LEAVE: string

The Event.MOUSE_LEAVE constant defines the value of the type property of a mouseLeave event object.

This event has the following properties:

Static OPEN

OPEN: string

The Event.OPEN constant defines the value of the type property of an open event object.

This event has the following properties:

Static PASTE

PASTE: string

Static REMOVED

REMOVED: string

The Event.REMOVED constant defines the value of the type property of a removed event object.

This event has the following properties:

Static REMOVED_FROM_STAGE

REMOVED_FROM_STAGE: string

The Event.REMOVED_FROM_STAGE constant defines the value of the type property of a removedFromStage event object.

This event has the following properties:

Static RENDER

RENDER: string

The Event.RENDER constant defines the value of the type property of a render event object.

Note: This event has neither a "capture phase" nor a "bubble phase", which means that event listeners must be added directly to any potential targets, whether the target is on the display list or not.

This event has the following properties:

Static RESIZE

RESIZE: string

The Event.RESIZE constant defines the value of the type property of a resize event object.

This event has the following properties:

Static SCROLL

SCROLL: string

The Event.SCROLL constant defines the value of the type property of a scroll event object.

This event has the following properties:

Static SELECT

SELECT: string

The Event.SELECT constant defines the value of the type property of a select event object.

This event has the following properties:

Static SELECT_ALL

SELECT_ALL: string

Static SOUND_COMPLETE

SOUND_COMPLETE: string

The Event.SOUND_COMPLETE constant defines the value of the type property of a soundComplete event object.

This event has the following properties:

Static TAB_CHILDREN_CHANGE

TAB_CHILDREN_CHANGE: string

The Event.TAB_CHILDREN_CHANGE constant defines the value of the type property of a tabChildrenChange event object.

This event has the following properties:

Static TAB_ENABLED_CHANGE

TAB_ENABLED_CHANGE: string

The Event.TAB_ENABLED_CHANGE constant defines the value of the type property of a tabEnabledChange event object.

This event has the following properties:

Static TAB_INDEX_CHANGE

TAB_INDEX_CHANGE: string

The Event.TAB_INDEX_CHANGE constant defines the value of the type property of a tabIndexChange event object.

This event has the following properties:

Static TEXTURE_READY

TEXTURE_READY: string

Static TEXT_INPUT

TEXT_INPUT: string

Defines the value of the type property of a textInput event object.

Note: This event is not dispatched for the Delete or Backspace keys.

This event has the following properties:

Static UNLOAD

UNLOAD: string

The Event.UNLOAD constant defines the value of the type property of an unload event object.

This event has the following properties:

Methods

clone

  • Duplicates an instance of an Event subclass.

    Returns a new Event object that is a copy of the original instance of the Event object. You do not normally call clone(); the EventDispatcher class calls it automatically when you redispatch an event - that is, when you call dispatchEvent(event) from a handler that is handling event.

    The new Event object includes all the properties of the original.

    When creating your own custom Event class, you must override the inherited Event.clone() method in order for it to duplicate the properties of your custom class. If you do not set all the properties that you add in your event subclass, those properties will not have the correct values when listeners handle the redispatched event.

    In this example, PingEvent is a subclass of Event and therefore implements its own version of clone().

    Returns Event

    A new Event object that is identical to the original.

formatToString

  • formatToString(className: string, ...args: any[]): string

isDefaultPrevented

  • isDefaultPrevented(): boolean
  • Checks whether the preventDefault() method has been called on the event. If the preventDefault() method has been called, returns true; otherwise, returns false.

    Returns boolean

    If preventDefault() has been called, returns true; otherwise, returns false.

preventDefault

  • preventDefault(): void
  • Cancels an event's default behavior if that behavior can be canceled. Many events have associated behaviors that are carried out by default. For example, if a user types a character into a text field, the default behavior is that the character is displayed in the text field. Because the TextEvent.TEXT_INPUT event's default behavior can be canceled, you can use the preventDefault() method to prevent the character from appearing. An example of a behavior that is not cancelable is the default behavior associated with the Event.REMOVED event, which is generated whenever Flash Player is about to remove a display object from the display list. The default behavior (removing the element) cannot be canceled, so the preventDefault() method has no effect on this default behavior. You can use the Event.cancelable property to check whether you can prevent the default behavior associated with a particular event. If the value of Event.cancelable is true, then preventDefault() can be used to cancel the event; otherwise, preventDefault() has no effect.

    Returns void

stopImmediatePropagation

  • stopImmediatePropagation(): void
  • Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow. This method takes effect immediately, and it affects event listeners in the current node. In contrast, the stopPropagation() method doesn't take effect until all the event listeners in the current node finish processing.

    Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.

    Returns void

stopPropagation

  • stopPropagation(): void
  • Prevents processing of any event listeners in nodes subsequent to the current node in the event flow. This method does not affect any event listeners in the current node(currentTarget). In contrast, the stopImmediatePropagation() method prevents processing of event listeners in both the current node and subsequent nodes. Additional calls to this method have no effect. This method can be called in any phase of the event flow.

    Note: This method does not cancel the behavior associated with this event; see preventDefault() for that functionality.

    Returns void

toString

  • toString(): string
  • Returns a string containing all the properties of the Event object. The string is in the following format:

    [Event type=_value_ bubbles=_value_ cancelable=_value_]

    Returns string

    A string containing all the properties of the Event object.

Generated using TypeDoc