Setselection (Selection.setselection Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

return false;
}
if (password_txt.text.length == 0) {
status_txt.text = "fill in password";
Selection.setFocus("password_txt");
return false;
}
status_txt.text = "success!";
Selection.setFocus(null);
return true;
}
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
See also
getFocus (Selection.getFocus method)

setSelection (Selection.setSelection method)

public static setSelection(beginIndex:Number, endIndex:Number) : Void
Sets the selection span of the currently focused text field. The new selection span will begin at
the index specified in the
parameter. Selection span indexes are zero-based (for example, the first position is
endIndex
0, the second position is 1, and so on). This method has no effect if there is no currently
focused text field.
Availability: ActionScript 1.0; Flash Player 5
Parameters
beginIndex:Number
- The ending index of the selection span.
endIndex:Number
Example
In the following ActionScript, you create a text field at runtime and add a string to it. Then
you focus the text field and select a span of characters in the focused text field.
this.createTextField("myText_txt", 99, 10, 10, 200, 30);
myText_txt.text = "this is my text";
this.onEnterFrame = function () {
Selection.setFocus("myText_txt");
Selection.setSelection(0, 3);
delete this.onEnterFrame;
}
MovieClip.getNextHighestDepth()
parameter, and end at the index specified in the
beginIndex
- The beginning index of the selection span.
method used in this example requires Flash Player
method.
Selection
1079

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