Button and keyboard event

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”);