Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

actionscript onClipEvent argument flash MX

Status
Not open for further replies.

cathiec

Programmer
Oct 21, 2003
139
IE
i have a piece of action script that takes a string in one text box and searches through text in another to find that string. if the string is found then it is highlighted.
i set the error:

Scene=Scene 1, Layer=Slides, Frame=3: Line 6: Invalid movie clip event specified.
onClipEvent(search_btn){

here is the actionscript:

// place code like this in the frame containing the searchable text, search string and search button
onClipEvent(search_btn){
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

}


do i have the wrong argument in the onClipEvent?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top