attaching mouse events to a flash object

S

Sharkie

I have a page with a flash object (an ad which will go to external site
following click). I would like to know when user clicked on the flash
object by catching the event, before the control is given to the
embedded flash code. Seems like this is impossible.

Here's what I tried:

1) surrounded flash object with div, and then attached onclick to the
div. Didn't help. Clicking inside the div, but outside flash will
trigger onclick. Clicking inside flash will not.

2)covered flash with transparent gif image, and attached onclick to the
gif. Same result as above.

3)tried using mousedown instead of click. Nope, didn't work either.

4)even mouseover seems to have no effect.

5)attached onclick to body. I was hoping I could read XY coordinates
from the event, and if within position of the ad, I would have my
event. But onclick does not trigger for the flash.


All solutions worked fine for any other HTML element, except for the
flash. What I don't understand how can flash take over local BOM, after
all it is part of it, right? Is capturing the mouse event when the
mouse pointer is over the flash even possible (w/o changing any code
inside the flash, since I don't have access to it) ?


Here's the div example, first HTML:

<div id="wrapDiv">
<OBJECT width="166" height="100"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="some_name"
id="some_id"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">
<PARAM name="movie" value="some_name">
<PARAM name="loop" value="false">
<PARAM name="quality" value="high">
<PARAM name="play" value="TRUE">
<EMBED width="166" height="100" src="some_name" name="some_name"
loop="false" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>
</div>

then javascript:
//attach event onload:
(window.attachEvent) ? document.attachEvent('onload', attachEvent) :
window.addEventListener('load', attachEvent, false);

//attach onclick to wrapDiv, this work fine for the div outside flash:
function attachEvent() {
document.getElementById('wrapDiv').onclick=fnTest;
}

function fnTest() {
alert('in fnTest()');
}

So, is it possible to catch the event somehow?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top