如果我向KeyboardEvent.KEY_DOWN 添加一个监听器,我可以找出keyCode 和charCode。
keyCode 根据键盘映射到不同的字符。
根据帮助,charCode 也同样没用:
The character code values are English keyboard values. For example, if you press Shift+3, charCode is # on a Japanese keyboard, just as it is on an English keyboard.
那么,我怎样才能找出用户按下了哪个字符呢?
最佳答案
你遗漏了引文的一个非常重要的部分,或者在你找到它的地方丢失了:
For example, if you press Shift+3, the getASCIICode() method returns # on a Japanese keyboard, just as it does on an English keyboard.
http://livedocs.adobe.com/flex/201/langref/flash/events/KeyboardEvent.html
这可能更有帮助:
The charCode property is the numeric value of that key in the current character set (the default character set is UTF-8, which supports ASCII).
您的应用程序确定使用什么字符集,这意味着即使您必须使用不同键盘局部变量的不同键来生成相同的字符,它也将具有相同的 charCode。
关于apache-flex - 找出按下的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/748884/