3

Is there a way I can have JavaScript/jQuery know when a Flash object has been clicked (and still have Flash process the click)?

I tried putting a table on top of the object with position: fixed and a z-index and the object set to param name='wmode' value='transparent' so I could have my JavaScript detect which column was clicked using jQuery's click(), but the clicks were never intercepted by JavaScript (Chromium Linux).

Is there another way to accomplish this?

2

2 Answers 2

10

Thank you Marty Wallace and Darwin!

<div id='flash'>
<object>
<param name='wmode' value='transparent' />
<embed src='foo.swf' wmode=transparent allowfullscreen='true' allowscriptaccess='always'>
</embed>
</object>
</div>

<div id='output'></div>

<script type='text/javascript'>
$('#flash').mousedown(function (e){
    $('#output').append('<br>X: ' + e.pageX + ' ; Y: ' + e.pageY);
});
</script>

After testing, the XY coordinates of any clicks on the Flash object will be accurately printed to the screen and mouse interaction with the Flash object will proceed as normal.

Sign up to request clarification or add additional context in comments.

1 Comment

this make the flash loose his background
0

Now irrelevant:

Only if you have access to the flash source using ExternalInterface call. This is one of the reasons why flash for web is evil.

2 Comments

I guess this would be more of a plugin model/browser issue rather than a specific Flash one. Maybe I'm wrong tho.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.