• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

"Enter" button keyCode change in AIR3.7

Participant ,
May 01, 2013 May 01, 2013

Copy link to clipboard

Copied

Not sure if this is a bug or a simple feature change?

I noticed that the soft keyboard 'Enter' key returns keyCode '10' instead of  the traditional '13' in AIR3.7 on Android (tested on a Nexus 4 & 7).

It means the hardcoded actionscript 'Keyboard.ENTER' no longer works for that button. For example, this won't catch the 'Enter' key:

_nameInput.addEventListener(KeyboardEvent.KEY_UP, keyUp);

private function keyUp(event:KeyboardEvent):void

{

          // test for '13'

          if (event.keyCode == Keyboard.ENTER)

          {

               //  submitting form here etc

          }

}

Instead, the Enter key will add a linebreak to the textfield.

My workaround is to detect both keycodes:

if (event.keyCode == Keyboard.ENTER || event.keyCode == 10)

TOPICS
Development

Views

955

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 03, 2013 May 03, 2013

Copy link to clipboard

Copied

Hi,

Could you please confirm the Enter key you are talking about. Is this the same as marked in red on the softkeyboard in the attached image.

Enter.png

Regards,

Nimit

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 03, 2013 May 03, 2013

Copy link to clipboard

Copied

Yes, that's the button I was talking about. Although I can see you're getting keyCode 13 when you try it. Here's what I see:

1. I bring up a login screen with 2 input textfields on (not stagetext, just normal single line input textfields). Then I tap on the username.

loginscreen.jpg

2.  I get this alternative layout alongside the soft keyboard (maybe because my app is in landscape?). I enter username and tap the key marked in red.

softkeyboard.jpg

3. The debug console traces this when I tap the key marked in red:

Key Event: [KeyboardEvent type="keyUp" bubbles=true cancelable=false eventPhase=2 charCode=10 keyCode=10 keyLocation=0 ctrlKey=false altKey=false shiftKey=false controlKey=false commandKey=false]

Incidentally, the 'Done' key does not trigger the keyboard event (but this is correct behaviour IMO, as it's not part of the keyboard). It might be nice to be able to capture it somehow though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 03, 2013 May 03, 2013

Copy link to clipboard

Copied

LATEST

Would it be possible for you to share a sample project at nimitja@adobedotcom so that we may try reproduce this locally?

-Nimit

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines