there are two text boxes in a frame in my movie, one called d and one called s. a button called search_btn has also been created. the pepose is to enter text into the textbox s and then click the button search_btn to search for the text in the textbox d. i am using the actionscript below but nothing happens when the button is clicked.
onClipEvent (load) {
stop();
/* d - is the instance id of the text field to be searched
s - is the instance id of the text (input) field to be searched for
search_btn - is the instance id of the search button placed in the frame with
the text fields
*/
var begin:Number; // beginning index of search string
var len:Number; // length of search string
TF = new TextFormat(); // text format for italic
TF.italic = true;
btnListener = new Object();
btnListener.click = function () {
begin = _root.d.text.indexOf(_root.s.text); // find the beginning of the string
len = _root.s.text.length; // find the length of the search string
d.setTextFormat(begin, begin + len, TF); // change the format of the located text
}
search_btn.addEventListener ("click", btnListener); // listener for search button
}
onClipEvent (load) {
stop();
/* d - is the instance id of the text field to be searched
s - is the instance id of the text (input) field to be searched for
search_btn - is the instance id of the search button placed in the frame with
the text fields
*/
var begin:Number; // beginning index of search string
var len:Number; // length of search string
TF = new TextFormat(); // text format for italic
TF.italic = true;
btnListener = new Object();
btnListener.click = function () {
begin = _root.d.text.indexOf(_root.s.text); // find the beginning of the string
len = _root.s.text.length; // find the length of the search string
d.setTextFormat(begin, begin + len, TF); // change the format of the located text
}
search_btn.addEventListener ("click", btnListener); // listener for search button
}