在 Flash Lite 中侦听按键时,我应该侦听 Key.Down 还是该键的数字代码?

发布于 2024-08-16 19:44:05 字数 529 浏览 6 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

離人涙 2024-08-23 19:44:05

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 using Key.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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文