Search code examples
androidiosactionscript-3apache-flexflex4

Flex 4.6 hide/dismiss softkeyboard


I'm having some issues with the softkeyboard behaviour in flex 4.6 and air 3.1

I have a list with a search bar on top. When a user selects the TextInput component the softkeyboard pops up like it should. Now when the user is done typing his text and presses the return (or the done/search/...) key I want the softkeyboard to disappear.

What I've tried so far:

  • I've set the returnKeyLabel property to "done" and the button shows up accordingly. However it only dismisses the keyboard on Android, on IOS the keyboard just stays up.

  • I then tried by not setting the returnKeyLabel and manually catching the Return key and setting the focus to another element that does not require a softkeyboard but that didn't work either.

  • I also tried by dispatching my own "faked" click events when the Return key was pressed but this also didn't work.

As part of searching about this problem I found this Dismiss SoftKeyboard in Flex Mobile but that didn't work either. Or at least not in flex 4.6

Now does anyone know of a good way to hide the softkeyboard or make the returnKeyLabel "done" work on IOS that will work with flex 4.6/air 3.1?


Solution

  • Have you tried something like this?

    <s:TextInput prompt="First Name" returnKeyLabel="done" enter="handlerFunction()"/>  
    private function handlerFunction():void{
        stage.focus = null
    }