EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Getendindex (Selection.getendindex 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...
Selection 1073
Mouse.addListener(mouseListener);
function getCaretPos() {
pos_txt.text = Selection.getCaretIndex();
}
The MovieClip.getNextHighestDepth() method used in this example requires Flash Player
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth() method.
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
Number - An integer.
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,

Table of Contents

Related product manuals