I have the following bit of code that searches a movie clip frame for an inputted text string. I works the first time the button is pressed...but doesnt work again...any ideas on how to clear the vars so it will work a second and third attempt?
Code:
on (release) {
//search testing+
import mx.controls.Alert;
my_snap.setSelected(index1, textSel, false);
var inputterString:String = _root.inputter;
var inputLength:Number = inputterString.length;
var my_mc:MovieClip = _root.viewport;
var my_snap:TextSnapshot = my_mc.getTextSnapshot();
var index1:Number = my_snap.findText(0, inputterString, false);
var textSel:Number = index1 + inputLength;
trace(index1);
trace(inputLength);
trace(textSel);
/////find selection
if (index1 != -1){
my_snap.setSelectColor(0xFF0000);
my_snap.setSelected(index1, textSel, true);
var theText:String = my_snap.getSelectedText(false);
}
if (index1 == -1){
mx.controls.Alert.show("Nothing found Matching your Search Criteria");
}
//end find
trace(theText); // Text
}