在 Flash Lite 中侦听按键时,我应该侦听 Key.Down 还是该键的数字代码?
adobe 文档说,当从手机监听按键事件时,您应该监听 Key.Down,但是当我跟踪按键的 Key.getCode() 时,我看到一个数字而不是字符串“<强>键.向下”。我正在设备中心本地测试这一点,目前没有手机来测试这一点。这是我的代码 -
keyListener = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
trace(Key.getCode()) // outputs 40
case (Key.DOWN) : // according to the docs
pressDown();
break;
}
}
我的问题是 - 这仅仅是因为我在设备中心进行测试,当我在手机上运行它时,我需要监听 Key.Down 吗?或者文档是错误的?另外,所有设备上的数字代码 (40) 是否一致? adobe 提供了什么?
谢谢大家
The adobe documentation says that when listening for a keypress event from a phone you should listen for Key.Down, however when I trace the Key.getCode() of keypresses I see a number not the string "Key.Down". I am tesing this locally in device central and do not have a phone to test this with at present. Here is my code -
keyListener = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
trace(Key.getCode()) // outputs 40
case (Key.DOWN) : // according to the docs
pressDown();
break;
}
}
My question is - is this simply because Im testing in device central and when I run it on the phone I will need to be listening for Key.Down? or is the documentation wrong? Also is the numeric code (40) consistent across all devices? What gives adobe?
thanks all
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Key.Down
等于 40,因此它会将其识别为相同。因此,您可以使用您喜欢的任何一个,但是,我建议使用Key.Down
因为对于那些没有记住按键代码的人(我们大多数人)来说它很容易识别。这些是 密钥JavaScript 的代码值。然而,我认为它们几乎是通用的
Key.Down
is equal to 40 so it will recognize it as the same. So you can use whichever one you prefer, however, I would recommend usingKey.Down
because it will be easily recognizeable for those who dont have Key Codes memorized (most of us).These are the Key Code Values for Javascript. However, I think they are pretty much universal