Getbeginindex (Selection.getbeginindex Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

When you test the SWF file, try using Tab to move between the two text fields. Make sure
that you select Control > Disable Keyboard Shortcuts so you can change focus between the
two fields using Tab.
See also
setFocus (Selection.setFocus method)

getBeginIndex (Selection.getBeginIndex method)

public static getBeginIndex() : Number
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).
Availability: ActionScript 1.0; Flash Player 5
Returns
- An integer.
Number
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;
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
method used in this example requires Flash Player
MovieClip.getNextHighestDepth()
method.
Selection
1071

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF