An example can also be found in the Strings.fla file in the ActionScript samples Folder.
Typical paths to this folder are:
Windows: boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript
Macintosh: Macintosh HD/Applications/Macromedia Flash 8/Samples and Tutorials/
Samples/ActionScript
See also
getEndIndex (Selection.getEndIndex method)
getCaretIndex (Selection.getCaretIndex method)
public static getCaretIndex() : Number
Returns the index of the blinking insertion point (caret) position. If there is no blinking
insertion point displayed, 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).
Availability: ActionScript 1.0; Flash Player 5
Returns
- An integer.
Number
Example
The following example creates and sets the properties of a text field at runtime. The
method is used to return the index of the caret and display its value in
getCaretIndex()
another text field.
this.createTextField("pos_txt", this.getNextHighestDepth(), 50, 20, 100,
22);
this.createTextField("content_txt", this.getNextHighestDepth(), 50, 50,
400, 300);
content_txt.border = true;
content_txt.type = "input";
content_txt.wordWrap = true;
content_txt.multiline = true;
content_txt.onChanged = getCaretPos;
var keyListener:Object = new Object();
keyListener.onKeyUp = getCaretPos;
Key.addListener(keyListener);
var mouseListener:Object = new Object();
mouseListener.onMouseUp = getCaretPos;
1072
ActionScript classes
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?