PDA

View Full Version : login code



hellohenric
December 29th, 2006, 07:42 AM
Hi,

Here are a code for login:

on (release) {
if(un == 'test' && pw == 'test') {
gotoAndStop("correct")
} else {
gotoAndStop("incorrect")
}
}

But something must be wrong, I write the correct username and password in the textboxes and then click login, but I come to incorrect frame... have I missed something here?

Cheers
HH

zellers
December 29th, 2006, 11:00 AM
ok.... Now, lets say taht you gave your username input textbox the instance name of "un" Your password input textbox would have the INSTANCE name of pw. Okay...

then for your button you would put




on (release) {
if(un.text == 'test' && pw.text == 'test') {
gotoAndStop("correct")
} else {
gotoAndStop("incorrect")
}
}



You have to put the ".text" after you refer to an input text box's text, or for dynamic text for that matter..

Hope this solves your problem

hellohenric
December 29th, 2006, 06:04 PM
ok.... Now, lets say taht you gave your username input textbox the instance name of "un" Your password input textbox would have the INSTANCE name of pw. Okay...

then for your button you would put




on (release) {
if(un.text == 'test' && pw.text == 'test') {
gotoAndStop("correct")
} else {
gotoAndStop("incorrect")
}
}

You have to put the ".text" after you refer to an input text box's text, or for dynamic text for that matter..

Hope this solves your problem

Thank you,
I noticed that I accidentally but the un and pw in the <instance name> It sould of course be placed in the variable.. my mistake.. now it works without the .text, but I'll use it.