Forum Moderators: open

Message Too Old, No Replies

Trigger click with coordinates in javascript

         

droopy

4:42 am on Sep 7, 2009 (gmt 0)

10+ Year Member



Hi,

I would like a piece of javascript to trigger a click on a element (or even the whole window or document) WITH coordinates.

I know how to trigger a click with an element click() function (example: [webmasterworld.com...]

But there does not seem to be a way to send coordinates.

This is useful to simulate clicks on images, or on non html content, such as flash movies, or other plugins...

Thanks.

daveVk

12:07 pm on Sep 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On decent browsers
[developer.mozilla.org...]

On IE
look up document.createEventObject() and element.fireEvent()

droopy

4:56 am on Sep 8, 2009 (gmt 0)

10+ Year Member



I tried to use createEvent, initMouseEvent and dispatchEvent, but this does not seem to actually send an event to the flash movie.

If i add a onclick property to the <embed> element containing the flash movie, the onclick event handler get triggered by the dispatch event.

Its like the html embed object get the event, but not the actual embeded object...

droopy

5:00 am on Sep 8, 2009 (gmt 0)

10+ Year Member



And also, when i actually click on the flash movie, the onclick handler does not get triggered.

This is in Firefox 3.0, using a flash widget embedded as follows:


<embed id="bms" width="425" height="350" type="application/x-shockwave-flash" src="http://www.example.com/bms/cyprien" />

[edited by: whoisgregg at 2:11 pm (utc) on Sep. 9, 2009]
[edit reason] Exemplified Flash URL. :) [/edit]

daveVk

10:33 pm on Sep 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry no experience of flash, try the flash forum if no luck here.