使用 jQuery 跟踪对 Flash 电影(对象/嵌入)的点击 [英] Track a click on a flash movie (object / embed) with jQuery

查看:31
本文介绍了使用 jQuery 跟踪对 Flash 电影(对象/嵌入)的点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个动态横幅系统,它可以处理 img 横幅,以及使用 object/embed 完成的 flash 横幅.整个站点大量使用 jQuery,包括处理点击"事件.

I am making a dynamic banner system which can handle img banners, as well as flash banners done with object/embed. The entire site makes heavy use of jQuery, including handling the 'click' events.

在跟踪图像本身的点击时,这显然不是问题(我跟踪父 DIV 标签上的点击.但是,当广告是 SWF 时,它会失败,正如我怀疑的那样.

This obviously isn't a problem when it comes to tracking the clicks on the image itself (i track the click on the parent DIV tag. However, it fails when the advert is an SWF, as I suspected it would.

是否有一种 jQuery 解决方法可以让我使用 DOM 捕获对 Flash 元素的点击?

Is there a jQuery workaround that would allow me to capture a click on a Flash element with the DOM?

推荐答案

如果您可以访问 SWF 的源代码,则可以使用 ExternalInterface 与包含的 html 页面进行通信.

If you have access to the source of SWF, you can use ExternalInterface to communicate with the containing html page.

//inside the flash movie:
stage.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void
{
   ExternalInterface.call("handleFlashClick", [parameters to the method]);
}

//javascript in the containing html page
function handleFlashClick()
{
  //call the jQuery method here.
}

这篇关于使用 jQuery 跟踪对 Flash 电影(对象/嵌入)的点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆