开发者

flex ExternalInterface won't execute call() function

开发者 https://www.devze.com 2023-04-01 23:00 出处:网络
For some reason, the ExternalInterface.avaiable shows true, but it won\'t call alert(). 开发者_C百科Can anyone shed some light to this problem?

For some reason, the ExternalInterface.avaiable shows true, but it won't call alert(). 开发者_C百科Can anyone shed some light to this problem?

private function checkEI():void {
     eiStatus = ExternalInterface.available.toString();
     ExternalInterface.call("alert", "hi");
}

My config is here:

var params = {
    menu: "false",
    scale: "noScale",
    allowFullscreen: "true",
    allowScriptAccess: "always",
    bgcolor: "",
    wmode: "direct" // can cause issues with FP settings & webcam
};

Looks like it has to do with not being in a webserver and the html file just being opened directly by the browser. Is there any way to get it to work without a webserver?


Try to specify both id and classid in embed parameters. It helped me in all the browsers (especially IE).


Here's my answer that I posted a while ago. Hope it helps.

Extract:

I figured out that for some reason ExternalInterface.call doesn't work on a file:// and needs http(s)://

So, anybody who is facing this problem, get your yourself a webserver(Apache) or a GAE for testing these kinds of things


Have you tried

ExternalInterface.call("javascript:alert", "hi");

On second thought, Flash's security policy disallows the swf from calling a javascript in an html over the file protocol. You will get this error: #2060: Security sandbox violation: ExternalInterface caller file: c:/test.swf cannot access file: c:\testhtml.htm

I believe a similar question also exists at Does ExternalInterface work on the file: protocol?

0

精彩评论

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