TextSnapshot.findText()
Availability
Authoring: Flash MX 2004.
Playback: SWF files published for Flash Player 6 or later, playing in Flash Player 7 or later.
Usage
my_snap.findText( startIndex:Number, textToFind:String, caseSensitive:Boolean
) : Number
Parameters
An integer specifying the starting point in
startIndex
A string specifying the text to search for. If you specify a string literal instead of a
textToFind
variable of type String, enclose the string in quotation marks.
caseSensitive
of the string in
textToFind
Returns
The zero-based index position of the first occurrence of the specified text, or -1.
Description
Method; searches the specified TextSnapshot object and returns the position of the first
occurrence of
textToFind
method returns -1.
Example
The following example illustrates how to use this method. To use this code, place a static text field
containing 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); // output: 4
trace(index2); // output: -1
trace(index3); // output: 4
See also
TextSnapshot.getText()
A Boolean value specifying whether the text in
.
found at or after
my_snap
my_snap
. If
startIndex
textToFind
to search for the specified text.
must match the case
is not found, the
TextSnapshot.findText()
965
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers