EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Getcaretindex (Selection.getcaretindex Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1072 ActionScript classes
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
Number - An integer.
Example
The following example creates and sets the properties of a text field at runtime. The
getCaretIndex() method is used to return the index of the caret and display its value in
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;

Table of Contents

Related product manuals