Flash:从浏览器中的另一个选项卡返回,Flash 可以侦听某种返回选项卡事件吗?

发布于 2024-07-05 11:32:40 字数 113 浏览 8 评论 0原文

我有这个 Flash 应用程序,您可以在观看视频时单击链接。 它将打开一个新选项卡并暂停视频。 现在,当您返回 Flash 应用程序时,如果视频能够再次开始播放就好了。 有没有办法、事件之类的来做到这一点?

I got this flash application where you can click a link while watching a video. It will open a new tab and pause the video. Now when you come back to the flash application it would be nice if the video would start playing again. Is there a way, an event or so to do this ?

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

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

发布评论

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

评论(4

半暖夏伤 2024-07-12 11:32:40

Flash 可能是不行的,但您可能会幸运地使用纯 JavaScript 并让它与您的 Flash 电影进行通信。 我建议您尝试一下 Window 的 onFocus 事件。

我以前从未使用过它,因此它可能不会在任何/所有浏览器上触发。

在 FF3 中有效。 它不是有效或好的代码,但它是您的垫脚石:

<html>
    <head></head>
    <body onFocus="alert('testing');"></body>
</html>

这也很烦人,因为单击“确定”警报会重新触发焦点。 Control+W 将为您关闭选项卡并允许您打破循环。

Flash is probably a no-go, but you might have some luck with pure javascript and have that communicate with your Flash Movie. I suggest you play around with the Window's onFocus event.

I've never used it before, so it might not trigger on any/all browsers.

This worked in FF3. It's not valid or good code but it's a stepping stone for you:

<html>
    <head></head>
    <body onFocus="alert('testing');"></body>
</html>

It's also really annoying because clicking okay ok the alert, re-triggers the focus. Control+W will close the tab for you and allow you to break the cycle.

℡Ms空城旧梦 2024-07-12 11:32:40

一种更简洁的方法是使用类似以下内容的方法:

stage.addEventListener( Event.ACTIVATE, playMovie );
stage.addEventListener( Event.DEACTIVATE, pauseMovie );

A cleaner approach would be to use something along the lines of this:

stage.addEventListener( Event.ACTIVATE, playMovie );
stage.addEventListener( Event.DEACTIVATE, pauseMovie );
牵强ㄟ 2024-07-12 11:32:40

我想我已经这样解决了:

我在舞台上监听 mouse_leave 事件,因为你的鼠标在另一个选项卡中时会离开舞台。 (或者至少,您必须单击一个选项卡才能返回到闪光灯,因此您总是会在闪光灯之外)。 当您离开舞台时,stageLeave 布尔值将设置为 true。

然后我有另一个事件侦听器 mouse_move,它将 stageLeave 布尔值设置为 false(当为 true 时)并调度自定义 STAGE_RETURN 事件。

这里唯一的旁注是,您必须在舞台上移动鼠标才能使视频再次播放。 但这是你无论如何都会做的事情。

I think i have solved it like this:

I listen to a mouse_leave event on the stage, because your mouse will leave the stage when in another tab. (or at least, you have to click a tab to get back to the flash, so you always end up outside of the flash). When you left the stage a stageLeave boolean is set to true.

Then I have another event listener, mouse_move that sets the stageLeave boolean to false (when true) and dispatches a custom STAGE_RETURN event.

The only sidenote here is that you'll have to move with the mouse over the stage to make the video play again. But that's something you will do anyway.

动次打次papapa 2024-07-12 11:32:40

当焦点进入和离开播放器时,Flash 播放器会发出激活和停用事件。 您或许可以使用它们,但它们仅限于仅在 Flash 内容焦点发生变化时使用,而不能在页面焦点发生变化时使用。

看看这里 blog.flexaxamples.com 查看如何使用 Flash 激活和停用事件。

The Flash player send outs activate and deactivate events when the focus enters and leaves the player. You could probably uses these, but they are limited to only when the flash content focus changes, not when the page focus changes.

Take a look here blog.flexaxamples.com to see how to use to the Flash activate and deactivate events.

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