flashx.textLayout.edit

# SelectionState - AS3

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.

Related API Elements

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
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | pointFormat : flashx.textLayout.formats:ITextLayoutFormat The format attributes applied to inserted text. | SelectionState
|  | textFlow : flashx.textLayout.elements:TextFlow Returns the TextFlow associated with the selection. | TextRange

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | SelectionState(root:flashx.textLayout.elements:TextFlow, anchorPosition:int, activePosition:int, format:flashx.textLayout.formats:ITextLayoutFormat = null) Creates a SelectionState object. | SelectionState
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | updateRange(newAnchorPosition:int, newActivePosition:int):Boolean [override] Updates the selection range with new anchor or active position values. | SelectionState
|  | valueOf():Object Returns the primitive value of the specified object. | Object

Property Detail

### pointFormat

property

`pointFormat:flashx.textLayout.formats: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():flashx.textLayout.formats:ITextLayoutFormat`
`public function set pointFormat(value:flashx.textLayout.formats:ITextLayoutFormat):void`

Related API Elements

ISelectionManager.getCommonCharacterFormat()
Constructor Detail

### SelectionState

()
Constructor

`public function SelectionState(root:flashx.textLayout.elements:TextFlow, anchorPosition:int, activePosition:int, format:flashx.textLayout.formats:ITextLayoutFormat = 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:flashx.textLayout.elements:TextFlow` — The TextFlow associated with the selection.
| `anchorPosition:int` — The anchor index of the selection.
| `activePosition:int` — The active index of the selection.
| `format:flashx.textLayout.formats:ITextLayoutFormat` (default = `null`)`` — The TextLayoutFormat to be applied on next character typed when a point selection

Related API Elements

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

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00