0
votes

i'm trying to call a method inside a flash movie from js, every time the mouse leaves the "div". It works on Internet Explorer, but not in firefox. any ideas?

here is the html script:

<script type="text/javascript">

     window.onload = function(e){

      init();

     }

     function init(){

      document.getElementById('div').onmouseout = function(e) {

       method();
      }

     }

     function method(){
       flashid.anothermethod();
     }
</script>

and the flash script:

import flash.external.ExternalInterface;

function outdiv(){
        //do something;
}

ExternalInterface.addCallback('anothermethod', outdiv);

Any ideas what's wrong?

EDIT: here is example of the problem, there is an alert for the js and the flash should be able to remove the swf (see a gray background? it works! see a image, flash didn't receive the call): http://complexresponse.com/out/addcallback_ff.html

this should work with internet explorer / safari / chrome (pc/mac) only firefox seams to reject this.

2
can you try adding an alert to your function method() to see if it gets called? Just want to make sure it really is ExternalInterface that's screwing up. - jonathanasdf
What's not working about it? Do you get any sort of error message in Firebug? - Matt Ball
@jonathanasdf the function is called from javascript @Bears will eat you no errors in Firebug - a--m
Have you fixed it because I am having the same problem, works in IE but not in FF and Chrome - tdtje

2 Answers

1
votes

the problem is that the event probably doesn't fire because of the flash. try to handle the mouseout event in the flash on your main movieclip and see if it fires

0
votes

Ensure that you're embedding flash with wmode set to "transparent". If not you won't get JavaScript events for DOM objects behind the flash object.