Apache Flex 4.16.0 API Reference | All Packages | All Classes | Index | Frames No Frames |
SelectionState

Package | flashx.textLayout.edit
Class | public class SelectionState
Inheritance | SelectionState TextRange Object

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The SelectionState class represents a selection in a text flow.

A selection range has an anchor point, representing the point at which the selection of text began, and an active point, representing the point to which the selection is extended. The active point can be before or after the anchor point in the text. If a selection is modified (for example, by a user shift-clicking with the mouse), the active point changes while the anchor point always remains in the same position.

See also

flashx.textLayout.edit.ISelectionManager.getSelectionState()
flashx.textLayout.elements.TextFlow
flashx.textLayout.elements.TextRange

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | absoluteEnd : int End of the selection, as an absolute position in the TextFlow. | TextRange
|  | absoluteStart : int Start of the selection, as an absolute position in the TextFlow. | TextRange
|  | activePosition : int Active position of the selection, as an absolute position in the TextFlow. | TextRange
|  | anchorPosition : int Anchor position of the selection, as an absolute position in the TextFlow. | TextRange
|  | cellRange : CellRange Range of table cells in selection (null if no cells selected) | SelectionState
|  | pointFormat : ITextLayoutFormat The format attributes applied to inserted text. | SelectionState
|  | textFlow : TextFlow Returns the TextFlow associated with the selection. | TextRange

Public Methods

| Method | Defined By
--- | --- | ---
|  | SelectionState(root:TextFlow, anchorPosition:int, activePosition:int, format:ITextLayoutFormat = null, cellRange:CellRange = null) Creates a SelectionState object. | SelectionState
|  | updateRange(newAnchorPosition:int, newActivePosition:int):Boolean [override] Updates the selection range with new anchor or active position values. | SelectionState

Property Detail

cellRange | property

`cellRange:CellRange`

Range of table cells in selection (null if no cells selected)

Implementation
`public function get cellRange():CellRange`
`public function set cellRange(value:CellRange):void`

pointFormat | property |

`pointFormat:ITextLayoutFormat`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

The format attributes applied to inserted text.

Note: The `pointFormat` object does not include inherited styles. To get all the applicable style definitions, use the `getCommonCharacterFormat()` method of the ISelectionManager class.

Implementation
`public function get pointFormat():ITextLayoutFormat`
`public function set pointFormat(value:ITextLayoutFormat):void`

See also

ISelectionManager.getCommonCharacterFormat()
Constructor Detail

SelectionState | () | Constructor

`public function SelectionState(root:TextFlow, anchorPosition:int, activePosition:int, format:ITextLayoutFormat = null, cellRange:CellRange = null)`

Language Version : | ActionScript 3.0

Runtime Versions : | Flash Player 10, AIR 1.5

Creates a SelectionState object.

Note: Do not construct a SelectionState object in order to create a selection. To create a selection in a text flow, call the `setSelection()` method of the relevant ISelectionManager instance (which is the SelectionManager or EditManager object assigned to the `interactionManager` property of the text flow).

Parameters

| `root:TextFlow` — The TextFlow associated with the selection.
| `anchorPosition:int` — The anchor index of the selection.
| `activePosition:int` — The active index of the selection.
| `format:ITextLayoutFormat` (default = `null`)`` — The TextLayoutFormat to be applied on next character typed when a point selection
| `cellRange:CellRange` (default = `null`)``

See also

flashx.textLayout.edit.ISelectionManager.getSelectionState()
flashx.textLayout.edit.SelectionManager
flashx.textLayout.edit.EditManager
Method Detail

updateRange | () | method

`override public function updateRange(newAnchorPosition:int, newActivePosition:int):Boolean`

Updates the selection range with new anchor or active position values.

The `pointFormat` styles are cleared if the selection is changed.

Parameters

| `newAnchorPosition:int` — the anchor index of the selection.
| `newActivePosition:int` — the active index of the selection.

Returns

| `Boolean` — true if selection is changed

Sun Mar 5 2017, 03:42 PM +11:00