如何检测鼠标何时位于 Flash 影片上的 HTML 层上?

发布于 2024-08-17 07:06:42 字数 383 浏览 5 评论 0原文

我有一个嵌入 HTML 页面的 Flash 影片,该页面在影片顶部的一层中有一个 DIV。 Flash 影片根据鼠标在影片上的位置滚动。客户端希望当鼠标悬停在 DIV 上时停止滚动。我尝试过使用 mouseLeave 事件,但这不是由 DIV 触发的。

有没有办法让 Flash 影片能够检测到鼠标何时位于 DIV 上?

Flash影片是使用Flash CS4和AS3开发的。

这是 DIV 标签:

<div style="position:absolute;top:0;left:0;width:1024;background:#fff;font-size:24px;z-order:2">
some text
</div>

I have a Flash movie that is embedded in an HTML page that has a DIV in a layer over the top of the movie. The Flash movie scrolls based on the mouse position over the movie. The client wants the scrolling to stop when the mouse is over the DIV. I've tried using the mouseLeave event, but that is not triggered by the DIV.

Is there a way that the Flash movie can detect when the mouse is over the DIV?

The Flash movie was developed using Flash CS4 and AS3.

Here's the DIV tag:

<div style="position:absolute;top:0;left:0;width:1024;background:#fff;font-size:24px;z-order:2">
some text
</div>

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

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

发布评论

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

评论(2

嗫嚅 2024-08-24 07:06:42

MOUSE_LEAVE 事件不起作用,因为即使鼠标位于 div 上,它仍然位于 SWF 的边界区域内。您必须在 Flash 中使用ExternalInterface 来注册一个可用于javascript 的函数,然后当鼠标悬停在div 上时调用该函数。 Flash 功能关闭滚动。

在 Flash 中:

import flash.external.ExternalInterface;
function stopScrolling() {
    // stop scrolling
}
ExternalInterface.addCallback('stopFlashScrolling', stopScrolling);

在 Javascript 中:

document.getElementById('theDiv').onmouseover = function(e) {
    MySWF.stopFlashScrolling();
}

MySWF 是 SWF 的 ID。

The MOUSE_LEAVE event doesn't work because even though the mouse is over the div, it's still within the bounding area of the SWF. You'd have to use ExternalInterface in Flash to register a function that will be available to javascript, then you call that when the mouse hovers over the div. The Flash function turns off the scrolling.

In Flash:

import flash.external.ExternalInterface;
function stopScrolling() {
    // stop scrolling
}
ExternalInterface.addCallback('stopFlashScrolling', stopScrolling);

In Javascript:

document.getElementById('theDiv').onmouseover = function(e) {
    MySWF.stopFlashScrolling();
}

MySWF is the id of your SWF.

花落人断肠 2024-08-24 07:06:42

Flash 电影(一般而言)始终具有最高的 z-index。您是否尝试过添加:

<param name="wmode" value="transparent"> 

到您的嵌入代码中?

Flash movies (in general) always have the highest z-index. Have you tried adding:

<param name="wmode" value="transparent"> 

to your embed code?

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