I have created a login form. On stage I have two text input fields and a button. I want the user to login by clicking the button or, by pressing Enter on the keyboard. Coming from AS2 I am not sure what the best approach is. Do I have to fire both input fields or just one? This is my code please tell me what I am doing wrong? Thanks inputfieldOne.addEventListener(MouseEvent.CLICK, btnSubmit); inputfieldOne.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); function btnSubmit(event:MouseEvent):void{ trace(“Login”); function keyHandler(event:KeyboardEvent):void{ if(event.keyCode == Keyboard.ENTER) trace(“keyboard was pressed”);
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
F8 AS2 How difficult is it to build a login form? | 0 | 95 | March 16, 2010 | |
Pressing Enter on the Keyboard | 0 | 168 | April 8, 2013 | |
Password buttons
|
0 | 36 | February 23, 2009 | |
[AS2] Using Arrow Keys for selection [HELP PLS!]
|
0 | 74 | November 2, 2007 | |
Actionscript 3.0 keycode numbers | 0 | 89 | March 3, 2008 |