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 | |
---|---|---|---|---|
Pressing Enter on the Keyboard | 0 | 170 | April 8, 2013 | |
Enter key | 0 | 42 | April 6, 2009 | |
Keyboard event for the ENTER key | 0 | 130 | March 6, 2010 | |
Form and enter key
|
0 | 49 | September 22, 2006 | |
Detect Enter Key | 0 | 53 | October 14, 2004 |