flexExternalInterface不会执行call()函数
由于某种原因,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
};
看起来它与不在网络服务器中并且 html 文件只是由浏览器直接打开有关。有没有办法让它在没有网络服务器的情况下工作?
For some reason, the ExternalInterface.avaiable shows true, but it won't call alert(). 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试在嵌入参数中指定
id
和classid
。它在所有浏览器(尤其是 IE)中对我都有帮助。Try to specify both
id
andclassid
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:
你有没有尝试
过再三考虑,
Flash 的安全策略不允许 swf 通过文件协议调用 html 中的 javascript。你会得到这个错误:
#2060: 安全沙箱违规:ExternalInterface 调用者文件:c:/test.swf 无法访问文件:c:\testhtml.htm
我相信 ExternalInterface 是否适用于文件:协议?
Have you tried
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?