I have one embed flash movie inside one div, I put one javascript onclick event handler in the main div, but isn't catching the click, what is wrong?
Code:
<div id="top-box-player" onclick="alert('Hi Bananas!');">
<object width="400" height="300">
<param name="movie" value="general.swf">
<embed src="./swf/general.swf" width="400" height="300">
</embed>
</object>
</div>
I found this at http://progproblems.blogspot.com/2009/08/javascript-onclick-for-flash-embeded.html
wmode
to transparent
. This allows the object containing the flash to receive the javascript onclick
.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 =)