Skip to main content
stolennickname
Inspiring
February 4, 2016
Question

Capturing raw soft keyboard input on iOS

  • February 4, 2016
  • 1 reply
  • 1153 views

I've followed the Adobe devnet article on capturing soft keyboard input but it doesn't work on iOS 9.2.

article: Capturing soft key input | Adobe Developer Connection

Setup: AIR 20.0.0.233 overlaid on Adobe Flex 4.6, targeting iOS SDK 9.2.

I'm controlling a TextInput instance. Setting the focus to it successfully brings up the soft keyboard. However, the only way I'm able to grab any input from the soft keyboard is by attaching a TextOperationEvent.CHANGE listener to the TextInput instance. KeyboardEvent.KEY_DOWN does not trigger. I've tried attaching a KeyboardEvent.KEY_DOWN listener to the instance, to the stage, and to NativeApplication.nativeApplication, and all fail.

Using TextOperationEvent.CHANGE works somewhat, but I can't perform capture of keycodes (e.g. Keyboard.UP), which is what I really need.

What's the proper, working way to capture soft keyboard key codes on iOS?

This topic has been closed for replies.

1 reply

tdwivedi
Adobe Employee
Adobe Employee
February 9, 2016

Hi ,

I'm trying to reproduce this issue. Meanwhile, can you give me some additional information, to narrow it down ?

1. Have you tried this with any other AIR build.

2. Are you facing this only with iOS 9.2, or with other iOS versions too ?

-Tushar,

Adobe AIR team

stolennickname
Inspiring
February 10, 2016

The problem occurs in AIR 19.0.0.241, AIR 20.0.0.233, and AIR21.0.0.128 overlaid on Adobe Flex 4.6.0, on both iOS 9.2.1 and Android 6.0.1.

These are the listener methods I've tried. Only one (marked) works:

// This works, but can't capture key codes:

_myTextInputInstance.addEventListener(TextOperationEvent.CHANGE, onTextInputChange);


// These three attempts fail:

_myTextInputInstance.addEventListener(KeyboardEvent.KEY_DOWN, onTextInputKeyDown);

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN,onNativeApplicationKeyDown);

this.stage.addEventListener(KeyboardEvent.KEY_DOWN, onStageKeyDown);

tdwivedi
Adobe Employee
Adobe Employee
February 10, 2016

Hi,

1. Are you using some specific skinClass for the text inputs ?

<s:TextInput skinClass="some.skinClass.mobile.TextInputSkin"/>

<s:TextArea skinClass="some.skinClass.mobile.TextAreaSkin"/>

Not all of them support KEY_UP or KEY_DOWN events.

Moreover, when the user interacts with the default soft keyboard for the TextInput and TextArea controls, the keyUp and keyDown events are dispatched only for a small subset of keys.

Reference : http://help.adobe.com/en_US/flex/mobileapps/WS82181550ec4a666a39bafe0312d9a274c00-8000.html

It would be great if you could provide us with a sample project in which you are able to reproduce this issue, so that we may know exactly what is troubling you.


-Tushar

Adobe AIR team