-
Comparing Variables AS2
Right now, i have two password fields with variables: pass1 and pass2. I'm making a register button. I need it to be something like:
if(pass1 == pass2){
on register_btn release{
gotoAndStop(2);
}
}
I don't know the correct syntax, please help.
-
Set the instance names of the to textboxes to 'pass1' and 'pass2'.
If you place the script on the frame:
PHP Code:
register_btn.onRelease = function(){ if(pass1.text == pass2.text){ gotoAndStop(2); } }
If you place it on the button:
PHP Code:
on(release){ if(pass1.text == pass2.text){ gotoAndStop(2); } }
-
Excellent, that works! Now. How do i prevent the gotoAndStop(2) part from running if both fields are blank. I tried:
if (pass1.text == pass2.text && pass1.text != ""){
execute command here}
However, it doesn't work
-
That should work. But keep in mind that will only disallow 'pass1' from beeing empty.
PHP Code:
if (pass1.text == pass2.text && pass1.text != "" && pass2.text != ""){ //If 'pass1' matches 'pass2' AND neither are empty, continue.
-
Hoorah, it worked! (idk why i didn't think of checking both fields DUH) Thanks very much, Vexy. Look forward to my next posts. >:]
-
Yay 
That's been my response to 99% of all script issues I've had too, after hours of pulling my hair out: "DUH"
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|