Differentiation between Return and numpad Enter

I am having problems with how to distinguish between the Return key on my keyboard and the Enter key located on the numeric keypad.

I have had success in sharing other keys with duplicates such as CTRL , ALT and Shift using:

if(e.keyLocation == KeyLocation.RIGHT) // is on right side of keyboard or if(e.keyLocation == KeyLocation.LEFT) // is on left side of keyboard 

However, when trying something like that, to highlight my Enter key from my Return key, using:

 if(e.keyLocation == KeyLocation.NUM_PAD) 

Flash insists on handling them like from KeyLocation.Standard . It is also worth mentioning that Flash treats both keys as the same key with the same keyCode (13) in the same way that CTRL , ALT and Shift use the same keyCode , but keyCode still cannot be isolated, as they can.

Does anyone have any ideas on how I can solve this problem? Or is it just a limitation with AS3? Thanks.

Edit: It may be worth noting that I am developing this for use with Adobe AIR as a desktop application.

+6
source share
3 answers

Sorry, this does not seem possible. After trying this for yourself, numpad_enter always returns KeyLocation = 0 (therefore it is standard, not left, right or numpad) and returns, as key code 13, the key code of the returned key.

Keyboard.NUMPAD_ENTER is defined as 108, although it will never be sent internally when the numpad_enter button is pressed, it will simply send a KeyboardEvent with the values โ€‹โ€‹of a regular enter button.

You can ask Adobe to fix this. Adobe HelpCenter

+1
source

Perhaps you are trying to use standalone FlashPlayer? You should try in your browser.

It can be shared by KeyLocation.NUM_PAD .

0
source

I confirmed that on Mac, the AIR runtime does not distinguish between the RETURN and numpad ENTER keys. They produce an identical output, so we are screwed. A rather unsuccessful oversight, but currently with tiny laptops no one sees both keys.

0
source

Source: https://habr.com/ru/post/959147/


All Articles