Flex:模拟按键 [英] Flex: Simulate key press
问题描述
现在,如果只有一个实际派遣一个KeyboardEvent的方法,Flex将实际上解释为一个真正的按键所有这些问题将会消失...这是可能的吗?
KeyboardEvent是用于启用发生键盘事件的通知。
要模拟键盘,您需要创建一个类,在接收到KeyboardEvent时将修改一个键盘的文本属性TextInput和相应的光标位置。
Alex Harui写了一篇关于这个 FlexCoders Post
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?
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
这篇关于Flex:模拟按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!