MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 671

Actionscript language reference
Table of Contents

Advertisement

Returns
An integer.
Description
Method; returns the index at the beginning of the selection span. If no index exists or no text field
currently has focus, the method returns -1. Selection span indexes are zero-based (for example, the
first position is 0, the second position is 1, and so on).
Example
The following example creates a text field at runtime, and sets its properties. A context menu item
is added that can be used to change the currently selected text to uppercase characters.
this.createTextField("output_txt", this.getNextHighestDepth(), 0, 0, 300,
200);
output_txt.multiline = true;
output_txt.wordWrap = true;
output_txt.border = true;
output_txt.type = "input";
output_txt.text = "Enter your text here";
var my_cm:ContextMenu = new ContextMenu();
my_cm.customItems.push(new ContextMenuItem("Uppercase...", doUppercase));
function doUppercase():Void {
var startIndex:Number = Selection.getBeginIndex();
var endIndex:Number = Selection.getEndIndex();
var stringToUppercase:String = output_txt.text.substring(startIndex,
endIndex);
output_txt.replaceText(startIndex, endIndex,
stringToUppercase.toUpperCase());
}
output_txt.menu = my_cm;
See Also
Selection.getEndIndex()
Selection.getCaretIndex()
Availability
Flash Player 5.
Usage
Selection.getCaretIndex() : Number
Parameters
None.
Returns
An integer.
Selection.getCaretIndex()
671

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents