Name

Selection.getEndIndex( ) Method — retrieve the index of the last selected character

Availability

Flash 5

Synopsis

Selection.getEndIndex( )

Returns

The index of the character after the last character in the current selection (highlighted block of text). If no text field has focus, it returns -1. If a text field has focus but no characters are selected, it returns the value of Selection.getCaretIndex( ).

Description

The getEndIndex( ) method identifies the end of a selection. To identify the span of characters currently selected, use both getEndIndex( ) and getBeginIndex( ).

Example

The following code extends the current selection by one character to the right:

Selection.setSelection(Selection.getBeginIndex(), Selection.getEndIndex( )+ 1);

See Also

Selection.getBeginIndex( ), Selection.getCaretIndex( )

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.