Skip to main content
Participant
August 29, 2012
Question

ios return key

  • August 29, 2012
  • 2 replies
  • 1343 views

Is there a way in Air to use the ios soft keyboard return key to fire a function?

Thanks in advance.

This topic has been closed for replies.

2 replies

Inspiring
August 22, 2013

this is incorrect... you can only listen for "DONE" not "Return"...

the enter button will say "Return" if your textfield is multiline. to make it say "DONE" set your textfield to singleline... yeah... exactly

Adobe Employee
August 30, 2012

If you are using TextField or StageText, add a event listener for KeyboardEvent.KEY_DOWN or KeyboardEvent.KEY_UP.

-Neha

xxboonexxAuthor
Participant
August 30, 2012

Nehgupta,

Thanks for the answer, I'm also wondering if there is a way to prevent the keyboard from hiding when they press return.

Again, thanks so much for your response.

-Boone

Adobe Employee
August 31, 2012

Yes, you can override the default behavior. Listen for KeyboardEvent.KEY_DOWN event and call event.preventDefault() if event.keyCode indicates return key is pressed.


function myKeyDown(event:KeyboardEvent):void
{
     event.preventDefault();

}


Hope it helps.

-Neha