How to catch click on flash player?

I`m using SWFObject for flash player on my webpage.
Player as usual has buttons like Play, Stop, Pause etc.
I need to catch moment, when my user click on any button and i need to execute some JS-function in this time.
Sorry for my english and thanks a lot in advance.
P.S. I dont have sources of my swf file.

  • Converting Flash Google Maps API to Javascript based in Flash?
  • Javascript or Flash export to CSV/Excel
  • render complex org chart similar javascript/flash/java graphic library
  • Hidden youtube player loses its methods
  • Javascript/Flash focus issue on different browsers
  • MediaElement.js setSrc not working for flash fallbacks on FF, IE7-8
  • Looking for web-based graph editing framework
  • How would I get a Hash value of a users file with Javascript or Flash?
  • how to automatically record a video response after the video stops playing using flash
  • How do you make a flash movie to play full screen mode using javascript?
  • Moving text circularly on web page
  • IE10/Safari Cannot Hide an Object/Flash inside of iFrame
  • 4 Solutions collect form web for “How to catch click on flash player?”

    AFAIK, this is done via the getURL() function. You need to define the following in the action script of the flash file:

    this.onClick = function(){ 

    This means you can’t just take any flash file and make it call JS functions, it must be defined within the flash file itself.

    If I am wrong, I’d love to hear how this can be done more generically without editing the flash itself.

    Calling a javascript function from flash can also be achieved using ExternalInterface.

    You can use the method onPress.


    [button_name].onPress = function(){

    //right here the stuff you wanna do



    At the risk of going out on a limb, I actually don’t think there’s any way, within the confines of cross-browser Javascript proper, to hook into specific Flash player activity like that. In fact I’d be very surprised indeed if there were — although I’d love to hear otherwise from someone more knowledgeable than me. 🙂

    Assuming that’s true, other than by some combination of listening (in the Javascript running in the context of your page) for focus and click events raised by the ActiveX/plug-in object itself (which probably wouldn’t be very specific or dependable — I don’t even think click events get raised ), I doubt you’d have much luck.

    From what brief testing I’ve done so far:

    window.onload = function()
        document.onclick = function()
            alert("Clicked the page!");
        document.getElementById("mySWFObjectID").onfocus = function()
            alert("Focused the player!");
        document.getElementById("mySWFObjectID").onclick = function()
            alert("Clicked the player!");

    … the player doesn’t seem to be bubbling click events up to the page; in IE, the focus event fires, but not in Firefox, and only once, when the control gains focus. So aside from writing, maybe, a browser plug-in of some kind, to get you some lower-level access than what’s exposed at the Javascript level, you might be out of luck on this one.

    But again, if there’s anyone out there who knows otherwise…