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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validating input text

Status
Not open for further replies.

Hskrdoo

Programmer
Aug 27, 2001
13
0
0
US
I have a quick question. I have a password input box. The user must type the word "hickory" and press ENTER in order to proceed. I don't care if the word is in all caps or a combination of uppercase and lowercase. I just want Flash to make sure the word "hickory" is typed regardless of the case. What is my button script going to look like?
 
Try this :

Code:
on (press) {
  if (inputtext != "hickory") {
    // do something eg:
    gotoAndStop("SecretFrame");
  } else {
    // do something else eg:
    call alert('Wrong password')
  }
}
Regards

Big Bad Dave

davidbyng@hotmail.com
 
You'll have to standardize the text to all-lower or all-upper case before checking it against an argument, if you want the user to be able to use a combination of both:

Code:
on (press) {
    inputText = inputText.toLowerCase();
    if (inputText == "hickory") {
        trace ("good");
    } else {
        trace ("nope");
    }
}

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top