hello all,
i have been lurking for about a month and I must say I am extremely impressed
and sometimes overwhelmed by the vast amount of knowledge on this list.
I have been searching for about a week for a simple solution to search within
a string for one word or two words. I am working on a quiz with several fill
in the blanks and I am sure my users will have a wide assortment of correct
answers but I am looking to see if they for example input either "cover" or
"time" in any of the text input boxes.
Stuff I have tried so far
substr - problem because i am checking for either I have resorted to the below
this.opened_btn.onRelease=function(){
myVar=open1.substr(0,4).toUpperCase();
myVar2=open2.substr(0,4).toUpperCase();
if
((myVar=="TIME"||myVar=="COVE"||myVar=="DATE")&&(myVar2=="TIME"||myVar2=="COVE"||myVar2=="DATE"))
{
gotoAndStop("quizend");
} else {
gotoAndStop("quizend");
}
}
I have also tried indexOf but I don't think I understood it because it would
pull any of the letters and make it a true condition(I left my comments in this
one so you could see what I don't understand)
this.opened_btn.onRelease=function(){
// toUpperCase() coverts the text instance to upper case
myVar=open1.toUpperCase();
myVar2=open2.toUpperCase();
//indexOF allows you to pull from the string and -1 allows the word to be
pulled from
//within anywhere in the string if you used 0 that would mean the string
would have
//to start with whatever is enclosed in the parenthesis
if
((myVar.indexOf("TIME")==-1||myVar.indexOf("COVER")==-1||myVar.indexOf("DATE")==-1)&&(myVar2.indexOf("TIME")==-1||myVar2.indexOf("COVER")==-1||myVar2.indexOf("DATE")==-1))
{
trace(myVar);
trace(myVar2);
trace("success");
gotoAndStop("quizend");
} else {
gotoAndStop("quizend");
trace("failure");
}
}
any help would be greatly appreciated. I have an assortment of fill in the
blanks and some of them are phrases and I would like to allow for some user
differences.
Sincerely,
Patricia Britt
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small
Business.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com