问题描述
我正在创建一个触摸屏Flex应用程序的虚拟键盘,我试图通过调度KeyboardEvent模拟按键。我已经写了一个处理函数来监听事件,并据此采取行动。到目前为止这么好...但它开始变得复杂,因为我必须管理焦点textInputs(简单),在这些字段中的光标位置(不那么容易),等现在,如果只有一个实际派遣一个KeyboardEvent的方法,Flex将实际上解释为一个真正的按键所有这些问题将会消失...这是可能的吗?
KeyboardEvent是用于启用发生键盘事件的通知。
要模拟键盘,您需要创建一个类,在接收到KeyboardEvent时将修改一个键盘的文本属性TextInput和相应的光标位置。
Alex Harui写了一篇关于这个
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:模拟按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!