Reputation: 10226
I have a flash object on my page and I want to disable clicks on it using Javascript. I tried to use the following code:
document.getElementById('flash-obj').onclick = function(){return false;};
document.getElementById('flash-obj').onmouseup = function(){return false;};
document.getElementById('flash-obj').onmousedown = function(){return false;};
It doesn't work. Is there any other alternative? Any examples would be appreciated.
Cheers Nyo
Upvotes: 2
Views: 2494
Reputation: 489
You could use ExternalInterface, something like this:
In flash, register a callback:
if (ExternalInterface.available)
{
flash.external.ExternalInterface.addCallback("myExternalMethod", myFunction);
}
function myFunction():void
{
myObj.removeEventListener(MouseEvent.CLICK, someFunction);
}
in JS, call the Flash method:
document.getElementById('flash-obj').myExternalMethod();
Upvotes: 1
Reputation: 22943
I think the only way to achieve what you want is using absolutely positioned element on top of the flash-object. The same technic is used to prevent mouse events to fire in iframe instead of main document.
Upvotes: 5