ExternalInterface.addCallback在firefox上不起作用?

时间:2010-04-15 16:10:11

标签: javascript flash actionscript-3

每次鼠标离开“div”时,我都试图从js中调用flash电影中的方法。 它适用于Internet Explorer,但不适用于Firefox。任何想法?

这是html脚本:

<script type="text/javascript">

     window.onload = function(e){

      init();

     }

     function init(){

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

       method();
      }

     }

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

和flash脚本:

import flash.external.ExternalInterface;

function outdiv(){
        //do something;
}

ExternalInterface.addCallback('anothermethod', outdiv);

任何想法有什么不对?

编辑:这里是问题的例子,有一个警告js和闪存应该能够删除SWF(见灰色背景?它工作!看到一个图像,闪存没有接到电话) : http://complexresponse.com/out/addcallback_ff.html

这应该适用于Internet Explorer / safari / chrome(pc / mac),只有firefox接口可以拒绝这一点。

2 个答案:

答案 0 :(得分:1)

问题是该事件可能因为闪光而无法触发。尝试在主动画片段的闪光灯中处理mouseout事件并查看它是否会触发

答案 1 :(得分:0)

确保将wmode设置为“transparent”的flash嵌入。如果不是,您将不会获得flash对象后面的DOM对象的JavaScript事件。