Skip to main content
Participant
Aug 29, 2012 11:33 PM UTC
Question

ios return key

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

Thanks in advance.

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Inspiring
Aug 22, 2013 10:09 PM UTC

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

Translate
Adobe Employee
Aug 30, 2012 5:33 AM UTC

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

-Neha

Translate
xxboonexxAuthor
Participant
Aug 30, 2012 3:11 PM UTC

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

Translate
Adobe Employee
Aug 31, 2012 6:24 AM UTC

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

Translate