Detecting Flash "Click" Event in JavaScript Across Browsers - Stack Overflow

Is there a way JavaScript can detect clicks (or mousedown, mouseup) that happen on Flash objects?I have

Is there a way JavaScript can detect clicks (or mousedown, mouseup) that happen on Flash objects?

I have tried:

  • Attaching the 'mouseup', 'mousedown', and 'click' events to the Flash object using attachEvent/addEventListener
  • Directly attaching the 'onmouseup', 'onmousedown', 'onclick' events inline on the Flash object
  • Switching from event 'bubbling' to event 'capturing' (only works in Firefox/Safari)

I need this to work in IE6+, Firefox 2+, and Safari 3+.

Thanks for any help! -Dave

Is there a way JavaScript can detect clicks (or mousedown, mouseup) that happen on Flash objects?

I have tried:

  • Attaching the 'mouseup', 'mousedown', and 'click' events to the Flash object using attachEvent/addEventListener
  • Directly attaching the 'onmouseup', 'onmousedown', 'onclick' events inline on the Flash object
  • Switching from event 'bubbling' to event 'capturing' (only works in Firefox/Safari)

I need this to work in IE6+, Firefox 2+, and Safari 3+.

Thanks for any help! -Dave

Share Improve this question edited Jul 21, 2009 at 14:32 asked Jul 21, 2009 at 14:27 ArtzStudioArtzStudio
Add a ment  | 

3 Answers 3

Reset to default 6

I found this at http://progproblems.blogspot./2009/08/javascript-onclick-for-flash-embeded.html

1) Set the param wmode to transparent. This allows the object containing the flash to receive the javascript onclick.
2) Use onmousedown insted of onclick. In spite of using wmode transparent, some browsers still wont call  the onclick, but they do call onmousedown.
The code looks like this:

<div onmousedown="clickBanner(1)">
<object>
<param name="movie" value="3.swf">
<param name="wmode" value="transparent" />
<embed wmode=transparent allowfullscreen="true" allowscriptaccess="always" src="3.swf"></embed>
</object>
</div>

It work for my needs =)

Do you own the flash objects?

We implemented call-backs from Flash to JavaScript when flash detects clicks. But we own the flash app and can manage the interaction.

Use the YAHOO yui.

If ( YAHOO.deconcept.SWFObjectUtil.getPlayerVersion().major == 0 ) {
  alert("error");
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744783047a4593455.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信