Mouse.addListener(mouseListener);
function getCaretPos() {
pos_txt.text = Selection.getCaretIndex();
}
The
MovieClip.getNextHighestDepth()
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
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
getEndIndex (Selection.getEndIndex method)
public static getEndIndex() : Number
Returns the ending index of the currently focused selection span. If no index exists, or if there
is no currently focused selection span, 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
This example is excerpted from the Strings.fla file in the ActionScript samples folder.
// define the function which converts the selected text in an instance,
// and convert the string to upper or lower case.
function convertCase(target, menuItem) {
var beginIndex:Number = Selection.getBeginIndex();
var endIndex:Number = Selection.getEndIndex();
var tempString:String;
// make sure that text is actually selected.
if (beginIndex>-1 && endIndex>-1) {
// set the temporary string to the text before the selected text.
tempString = target.text.slice(0, beginIndex);
switch (menuItem.caption) {
case 'Uppercase...' :
// if the user selects the "Uppercase..." context menu item,
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
method.
Selection
1073
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?