简体   繁体   English

如何防止F10激活AS3 AIR应用程序中的菜单?

[英]How do I keep F10 from activating menu in AS3 AIR application?

I'm developing an AIR application in Flash CS5.5 using ActionScript 3. The user must be able to use function keys F1-F10 for custom app-specific functions. 我正在使用ActionScript 3在Flash CS5.5中开发AIR应用程序。用户必须能够将功能键F1-F10用于自定义应用程序特定的功能。 They all work great, except F10. 除了F10之外,它们都运作良好。 I can detect keyUp and keyDown for F10 just fine, but when F10 is released, the application menu receives focus and the app ignores subsequent function key presses until either a)F10 is pressed again, or b)a non-function key is pressed. 我可以很好地检测到F10的keyUp和keyDown,但是当释放F10时,应用程序菜单将获得焦点,并且该应用程序将忽略后续的功能键,直到再次按下a)F10或b)按下了非功能键。 This happens whether or not I've added a new NativeMenu (I'd prefer the app to NOT have one). 无论我是否添加了新的NativeMenu(我希望该应用程序都没有一个),都会发生这种情况。

Is there a way to either, 有没有办法

  1. Prevent the menu from receiving focus when pressing F10, or 按F10时阻止菜单获得焦点,或者
  2. Force the focus to return to the content after pressing F10 so that a subsequent function key press will be recognized? 按下F10后强制焦点返回到内容,以便可以识别随后的功能键按下吗?

It's possible to create you own completely custom menu without relying on the default menu items and adding to them, which is what you might have to do in this situation. 您可以创建自己的完全自定义菜单,而无需依赖默认菜单项并将其添加到菜单中,这是您在这种情况下可能要做的。

You could try preventing the default event from firing on mouse up, but that's a bit of a ghetto/hack solution if it even works so i would suggest that instead you build your own native menu items from scratch. 您可以尝试阻止默认事件在鼠标按下时触发 ,但是如果它可以工作的话,这是一个贫民窟/黑客解决方案,所以我建议您从头开始构建自己的本机菜单项。 basically it's the same thing as what you are doing, except you have to first remove all the default menu items ("File", "Edit", etc.) and optionally replace them with your own default items. 基本上,这与您所做的是一样的,除了必须首先删除所有默认菜单项(“文件”,“编辑”等),然后可以选择将其替换为自己的默认项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM