开发者

externalinterface.call won't call the JavaScript function - Firefox 3.6

开发者 https://www.devze.com 2023-02-09 14:05 出处:网络
I have a function defined in JavaScript like so: function fadeBack() { alert(\"fadeBack called\"); }; I call that function from my Flash file like so:

I have a function defined in JavaScript like so:

function fadeBack() {
    alert("fadeBack called");
};

I call that function from my Flash file like so:

import flash.external.*;
flash.external.ExternalInterface.c开发者_如何学Goall("fadeBack");

This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?


Make sure you have the following parameter set in your HTML or JS embed:

allowScriptAccess="always"


I had the identical problem in Firefox. After I updated to FireFox 6.02, the problem went away - your code should work fine in version 6.02. I cannot confirm in which version of Firefox this issue was resolved.


This could be due to the lack of an <embed> tag. If you are using SWFObject 2, it no longer adds the <embed> tag inside the <object> tag. I believe that using ExternalInterface in Firefox requires the <embed>.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号