views:

1420

answers:

2

I'm creating a virtual keyboard for a touchscreen Flex app and i'm trying to simulate a key press by dispatching a KeyboardEvent. I've written a handler function to listen for the event and act accordingly. So far so good... but it's starting to get complicated as i have to manage the focused textInputs (easy), the cursor position in those fields (not to so easy), etc. Now, if only there was a way to actually dispatch a KeyboardEvent that Flex would actually interpret as a genuine key press all those issues would be gone... Is that possible?

+2  A: 

The TextInput does not use KeyboardEvent/TextEvent for text input, it uses internal Flash TextField objects that interact with the Flash Player / Keyboard.

The KeyboardEvent are used to enable notification of the Keyboard Event that occured.

To simulate a keyboard, you will need to create a class that upon recieving a KeyboardEvent will modify the text property of a TextInput and the cursor position accordingly.

Alex Harui has written a similar post about this FlexCoders Post

Peter Dolukhanov
A: 

I'm looking into the same issue and potentially found another path: automation (via http://www.mail-archive.com/[email protected]/msg53434.html).

Have not completely resolved this satisfactorily yet.