I'm making a simple password for a website, where the password is stored as a string on a timeline script.
I'm using nested conditionals (which may not be very elegant but should work) to first react when the enter key is pressed, and then look at the contents of the input text.
If the input text isn't the same as the password, then it goes to an error page, otherwise it goes to on to let you in on the website.
However, the code below is not robust enough, because if I press only the Enter key, the input text is not trapped by the conditionals. I've been trying to figure this out for ages now, and I can't.
Also, another question. I would like to be able to clear the input text area, when an error is detected. How can I do that?
var nameText:String = "hello"
if (evt.keyCode == Keyboard.ENTER)
if (inputText.text != nameText)
gotoAndStop(2);//displays an error message
trace ("Outside conditionalas: inputText.text = "+inputText.text)