1

I have a little problem with simulating a click with javascript.

I'm aware of the .click() method but the click must be on a prezi loaded (flash) so don't really have a html element to use.

What I have instead are the exactly coordinates of the place I want to simulate click on. Is there any way I can do that?

The click must activate a flash element. (A play button)

Note: There is a similar question around that have an answer witch require swf control. I don't have that so that method is not applicable.

One other quick question... what happens if I simulate a click on an element that has display: none. It click on the elements "under" it? (as a normal click would do; and yes I know this sounds funny but I don't know how to explain it otherwise). If yes I was thinking of making a position absolute div, put it on top of flash and use .click(). The problem is that i have a feeling that the click won't be applied on flash.

This is somehow a combination of javascript simulate mouse click on specific position and mouse click somewhere else on page (not on a specific div).

Community
  • 1
  • 1
zozo
  • 8,230
  • 19
  • 79
  • 134

1 Answers1

1

Make a transparent gif and position it absolute in your page wherever you need, then simulate a click on it.

I use this technique on some flash ads because I don't want to open links using JavaScript (since some users can be prompted with a question if they wan't or not to open a new page on click).

alessioalex
  • 62,577
  • 16
  • 155
  • 122
  • I don't really get it... why a gif? I tried this adding
    Un imba test.
    And simulate click on it and not working. I'll try what you said but I doubt the flash action will be launched.
    – zozo Dec 22 '11 at 08:57
  • I was not talking about flash actions, just action triggered by you (in your code). I had flash ads to display and they didn't do anything on click so I came up with this solution. Edit: A gif because it's transparent, you don't even know it's there :) – alessioalex Dec 22 '11 at 09:03
  • Sorry... my mode of explaining what I need to do might be a bit foggy sometimes. I have a play button in flash... I need to simulate a click on it when the user clicks some other place in the page. – zozo Dec 22 '11 at 09:06
  • 1
    Ah, since the button is flash I don't think you can simulate a proper click on it with JavaScript. – alessioalex Dec 22 '11 at 09:16
  • 1
    What about a not so proper one? :) (that's a joke... ty for your time) – zozo Dec 22 '11 at 09:28