在 Flex 3 / Flash 中取消键盘事件
我有一个 textArea,并希望阻止某些键(例如回车键)在用户输入时运行的默认行为。但是,KeyboardEvent 不可取消,因此 PreventDefault 不起作用。有谁知道如何做到这一点?
I have a textArea and would like to prevent the default behavior for certain keys such as the enter key from being run upon user input. However, KeyboardEvent is not cancelleable so preventDefault does not work. Does anyone know how this could be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我找到了一个非常简单的解决方法,只需使用 TextInput 事件即可取消,并且可以解决输入键的问题。另外,TextInput 事件不会因退格键而触发,这不会影响我在这里尝试执行的操作,但仅供参考。
Think I found a pretty easy workaround just using the TextInput event which is cancelleable and does the trick for the enter key. Also, TextInput event doesn't fire for the backspace key, which doesn't affect what I'm trying to do here but fyi.
像这样的东西可能有用吗?我自己还没试过。
Something like this might work? i haven't tried this my self tho.