Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
SelectionEvent

Package | flashx.textLayout.events
Class | public class SelectionEvent
Inheritance | SelectionEvent flash.events.Event

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

A TextFlow instance dispatches a SelectionEvent object when an EditManager or SelectionManager changes or selects a range of text. For example, this event is dispatched not only when a range of text is selected, but also when the selection changes because the user clicks elsewhere in the text flow. Moreover, this event is also dispatched when an EditManager changes the text or text formatting within a range of text.

Public Properties

| Property | Defined By
--- | --- | ---
|  | selectionState : SelectionState An object of type SelectionState that represents the selected range associated with this SelectionEvent. | SelectionEvent

Public Methods

| Method | Defined By
--- | --- | ---
|  | SelectionEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, selectionState:SelectionState = null) Creates an event object that contains information about a flow operation. | SelectionEvent

Public Constants

| Constant | Defined By
--- | --- | ---
|  | SELECTION_CHANGE : String = selectionChange [static] The SelectionEvent.SELECTION_CHANGE constant defines the value of the type property of the event object for a selection event. | SelectionEvent

Property Detail

selectionState | property

`selectionState:SelectionState`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

An object of type SelectionState that represents the selected range associated with this SelectionEvent.

You can use this property, along with the ElementRange class, to create an ElementRange instance that represents the range of selected text. You can use the following line of code to create an instance of the ElementRange class that represents the range of selected text (the `ev` variable represents the event object, and the conditional operator is used to guard against a `null` value for the `selectionState` property):

             // Find selected element range
             var range:ElementRange = ev.selectionState ?
                 ElementRange.createElementRange(ev.selectionState.textFlow,
                 ev.selectionState.absoluteStart, ev.selectionState.absoluteEnd) : null;

Implementation
`public function get selectionState():SelectionState`
`public function set selectionState(value:SelectionState):void`

See also

flashx.textLayout.edit.ElementRange
flashx.textLayout.edit.SelectionState
Constructor Detail

SelectionEvent | () | Constructor

`public function SelectionEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false, selectionState:SelectionState = null)`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

Creates an event object that contains information about a flow operation.

Parameters

| `type:String` — The type of the event. Event listeners can access this information through the inherited `type` property. There is only one type of SelectionEvent: `SelectionEvent.SELECTION_CHANGE`;
| `bubbles:Boolean` (default = `false`)`` — Indicates whether an event is a bubbling event.This event does not bubble.
| `cancelable:Boolean` (default = `false`)`` — Indicates whether the behavior associated with the event can be prevented.
| `selectionState:SelectionState` (default = `null`)`` — An object of type ElementRange that describes the range of text selected.

Constant Detail

SELECTION_CHANGE | Constant

`public static const SELECTION_CHANGE:String = selectionChange`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The SelectionEvent.SELECTION_CHANGE constant defines the value of the type property of the event object for a selection event.

Wed Nov 15 2017, 09:50 AM +01:00