使用jQuery跟踪Flash电影(对象/嵌入)的点击 [英] Track a click on a flash movie (object / embed) with jQuery
问题描述
我制作一个动态横幅系统,可以处理img横幅,以及使用对象/嵌入的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解决方法,这将允许我捕获一个Flash元素与DOM的点击?
Is there a jQuery workaround that would allow me to capture a click on a Flash element with the DOM?
推荐答案
如果您可以访问SWF的源代码,可以使用 ExternalInterface
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屋!