Flex: simulate a keystroke

I am creating a virtual keyboard for a touch-screen Flex application, and I am trying to simulate a keystroke by sending a KeyboardEvent. I wrote a handler function to listen to the event and act accordingly. So far, so good ... but it is starting to get more complicated, because I need to control focused text inputs (easy), the cursor position in these fields (not so simple), etc. Now, if there was a way to actually send a KeyboardEvent that Flex would actually interpret as a genuine key, all these problems would disappear ... Is this possible?

+3
source share
1 answer

TextInput does not use KeyboardEvent / TextEvent to enter text, it uses internal Flash TextField objects that interact with Flash Player / Keyboard.

KeyboardEvent is used to enable keyboard event notification.

To simulate a keyboard, you need to create a class that, after receiving the KeyboardEvent, will change the TextInput text property and cursor position, respectively.

Alex Harui wrote a similar post about this FlexCoders Post

+4
source

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


All Articles