ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > TextSnapshot > findText (TextSnapshot.findText method) | |||
Searches the specified TextSnapshot object and returns the position of the first occurrence of textToFind found at or after startIndex. If textToFind is not found, the method returns -1.
Availability: ActionScript 1.0; Flash Player 7 - The SWF file must be published for Flash Player 6 or later, and must be played in Flash Player 7 or later.
startIndex:Number - Specifies the starting index point in the TextSnapshot text at which to search for the specified text.
textToFind:String - The text to search for. Specify either a String literal (enclosed in quotation marks) or a variable.
caseSensitive:Boolean - Boolean value that specifies whether the found text must match the case of the string in textToFind (true); otherwise false.
Number - The zero-based index position of the first occurrence of the specified text, or -1 if no text matched.
The following example illustrates how to use this method. To use this code, place a static text field that contains the text "TextSnapshot Example" on the Stage.
var my_mc:MovieClip = this; var my_snap:TextSnapshot = my_mc.getTextSnapshot(); var index1:Number = my_snap.findText(0, "Snap", true); var index2:Number = my_snap.findText(0, "snap", true); var index3:Number = my_snap.findText(0, "snap", false); trace(index1); // 4 trace(index2); // -1 trace(index3); // 4
getText (TextSnapshot.getText method)
|
|
|
|