Flash 应用程序在没有焦点的情况下接收鼠标事件

发布于 2024-11-08 07:18:28 字数 213 浏览 1 评论 0原文

只是想问一下 Flash 应用程序在失去焦点时是否可以捕获鼠标和键盘事件。我尝试通过 SWFObject 库将其放入 div 容器中,然后使用 jquery 转发鼠标事件插件,但没有成功。我的想法是捕获body上的鼠标事件(点击事件),然后将其传输到flash应用程序。有人有一些建议或知道解决方法吗?考虑到关键事件,我还没有尝试过任何事情。我经营一个 Flash 游戏网站,我认为添加该功能将是一个很酷的功能。

Just wanted to ask is it possible for a flash app to capture mouse and keyboard events when it loses focus. I've tried putting it in a div container through SWFObject library and than used jquery forward mouse events plugin, but without success. My idea was to capture mouse events (click event) on the body and then transfer it to the flash app. Anybody has some suggestions or knows about a workaround? I haven't tried anything considering the key events. i run a flash games website and i think it will be a cool functionality to add.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

多情出卖 2024-11-15 07:18:28

在我看来,您应该能够捕获页面上的任何鼠标事件并通过ExternalInterface 将其传递给swf。如果不是 body 元素(这看起来确实应该起作用),那么其他一些包含元素会扩展到 flash 对象之外。

我想我的答案是你的方向应该有效。无论如何,这将是我的路线。我想不出它不起作用的任何原因...

您如何向页面元素添加侦听器?

It seems to me you should be able to capture any mouse event on the page and pass it along to an swf via ExternalInterface. If not the body element (which does seem like it should work), then some other containing element that expands outside the flash object.

I guess my answer is that your direction should work. It would be my route, anyway. I can't think of any reasons that it wouldn't work...

How are you adding listeners to your page elements?

抽个烟儿 2024-11-15 07:18:28

有一些内置功能可以帮助您实现您想要做的事情:

1) 当您单击 Flash 影片/单击 Flash 影片外部进行给予/获取时,Stage 对象将触发 Event.ACTIVATE 和 Event.DEACTIVATE 事件远离焦点。请参阅此链接获取教程

2) Stage 对象将触发 Event.MOUSE_LEAVE< /a> 鼠标光标离开舞台区域时的事件

There are some build-in features that can help you achieve what you want to do:

1) Stage object will fire Event.ACTIVATE and Event.DEACTIVATE events when you click in the flash movie / click outside of the flash movie to give / take away focus. See this link for a tutorial.

2) Stage object will fire an Event.MOUSE_LEAVE event when mouse cursor leaves the stage area

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