Groups | Blog | Home
all groups > flash actionscript > may 2006 >

flash actionscript : Password


Hoppie
5/10/2006 8:49:07 PM
The script below works just fine but I would like the Username & Password NOT
be case sensitive. What should I change.


on (release, keyPress "<Enter>") {
if (user add pass eq "cf" add "123") {
getURL("reps_only.html", "_self");
} else if (user add pass eq "cf" add "456") {
getURL("reps_only.html", "_self");
} else {
gotoAndPlay("failure", "tryAgain");
}
}
on (release, keyPress "<Enter>") {
user = "";
pass = "";
}
TimSymons
5/11/2006 1:03:13 AM
I am not very familar with the older syntax. However, with the String class you
have a method named toLowerCase(). It works like this.

var myStr:String = "Tim Symons";
trace(myStr.toLowerCase());

This would produce: tim symons

According to the Help Docs this was available in Flash 5. So you might be able
to rewrite you code as:

on (release, keyPress "<Enter>") {
if ((user+pass).toLowerCase() == "cf123") {
getURL("reps_only.html", "_self");
} els if ((user+pass).toLowerCase() == "cf456") {
getURL("reps_only.html", "_self");
} else {
gotoAndPlay("failure", "tryAgain");
}
}

on (release, keyPress "<Enter>") {
user= "";
pass= "";
}

Tim


Hoppie
5/11/2006 3:00:34 PM
AddThis Social Bookmark Button