由于某些原因,ExternalInterface.avaiable显示为true,但它不会调用alert()。有没有人能解释一下这个问题?
private function checkEI():void {
eiStatus = ExternalInterface.available.toString();
ExternalInterface.call("alert", "hi");
}我的配置如下:
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "",
wmode: "direct" // can cause issues with FP settings & webcam
};看起来这与不在and服务器中,html文件只是由浏览器直接打开有关。有没有办法让它在没有网络服务器的情况下工作?
发布于 2011-09-03 14:55:01
尝试在嵌入参数中同时指定id和classid。它帮助我在所有的浏览器(特别是IE)。
发布于 2012-06-15 10:04:14
Here's我前段时间发布的答案。希望能有所帮助。
摘录:
我发现由于某种原因,ExternalInterface.call在
://上不起作用,需要http://
所以,任何面临这个问题的人,给自己弄一个网络服务器(Apache)或者一个GAE来测试这些东西
发布于 2011-09-03 16:01:06
你试过了吗?
ExternalInterface.call("javascript:alert", "hi");再三考虑,Flash的安全策略禁止swf通过文件协议调用html中的javascript。你将会得到这个错误:#2060: Security sandbox violation: ExternalInterface caller file: c:/test.swf cannot access file: c:\testhtml.htm
我相信在Does ExternalInterface work on the file: protocol?也存在类似的问题
https://stackoverflow.com/questions/7291368
复制相似问题