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

flash actionscript : Login / Security



cinemaguy
12/1/2006 1:07:18 PM
Are userName and password variables? If they are text fields as I think
they might be you need to put userName.text and password.text
Xcelsia
12/1/2006 8:55:59 PM
Hi there,

Trying to implement a login element to my site where access will be granted to
a secret section of the site upon using the correct user name and password. I
will using attchMovie to display an error message if they are incorrect and
will jump to the secret section using gottoandplay with frame labels.

To check the if/else i am simply jumping to a label on each condition. Even if
i input the correct username and password it still jumps to contactspage? Any
ideas. The code was taken from a past thread by KGlad.

The code i am using is as follows:

on (release, keyPress "<Enter>") {
if (userName == "Vantage" && password == "Bauer") {
_root.gotoAndPlay ("homepage");
} else {
_root.gotoAndPlay ("contactspage");
}
}

MotionMaker
12/1/2006 9:36:18 PM
Code seems fine as posted. You may want to trace userName and password inside
the on. You also might want to be sure there are no other gotoAnd.. statements
in other parts of code. Use the MovieExplorer to see all code.



on (release, keyPress "<Enter>") {
trace (userName);
trace(password);
if (userName == "Vantage" && password == "Bauer") {
LuigiL
12/1/2006 9:42:48 PM
The code you posted would only work if you set a var using the property
inspector. If you use instance names then you need to check the text property:
if (userName.text == "Vantage" && password.text == "Bauer") {
cinemaguy
12/4/2006 12:34:49 PM
textfield.password = true;
Xcelsia
12/4/2006 5:04:30 PM
Thanks for the feedback.

Both the instance name and var were set. When the var is set i get the
following appear in the input boxes?

_level0.instance10.login
_level0.instance10.password

I have tried the suggested methods and both still jump back to the same
'contacts' page and not 'home' if right contacts if wrong?

There is definetaly no other command sending you to another label or frame?
Xcelsia
12/4/2006 5:06:58 PM
Xcelsia
12/4/2006 5:13:13 PM
LuigiL
12/5/2006 9:21:10 AM
Set the password property of the text field to true:
password_txt.password = true;
AddThis Social Bookmark Button