Click to See Complete Forum and Search --> : btn should work on press of enter key


Divyakedia
08-31-2006, 12:40 AM
Hi,
I have made a btn with instance name: login_btn. it is not a component btn. there r 2 text input boxes on the stage, when the btn is clicked i have this code:

on (release) {
if ((uname.text == "") || (pwd.text == "")) {
mx.controls.Alert.show("Empty Field(s)!", "Sorry", Alert.OK, null, onUserChoice, null, Alert.NO);
} else {
uname_login = uname.text;
pwd_login = pwd.text;
// not empty, validate data
validatename();
}
what i want is that at this moment this code happens only if we 'click' the btn, i want it to also work when we 'press' the enter key. what code should i write so that both work : press btn thru mouse and press of 'enter key'.

Mig
09-01-2006, 07:35 AM
on (keyPress "<ENTER>") {
// Whatever
}

Divyakedia
09-01-2006, 10:15 AM
Yeah, thanks :)