【发布时间】:2017-07-19 12:04:53
【问题描述】:
import flash.html.HTMLLoader;
import flash.events.Event;
import flash.external.ExternalInterface;
var _htmlLoader: HTMLLoader=new HTMLLoader() ;
_htmlLoader.runtimeApplicationDomain = ApplicationDomain.currentDomain;
_htmlLoader.load(new URLRequest("http://knights-honor.com/index.php"));
_htmlLoader.addEventListener(Event.COMPLETE, onComplete);
function onComplete(ev: Event) {
_htmlLoader.width = stage.width;
_htmlLoader.height = stage.height;
this.addChild(_htmlLoader);
ExternalInterface.call("games()");//to call the games function from javascript wittin htmlloader
}
但我收到此错误: 错误:错误 #2067:此容器中的 ExternalInterface 不可用。 ExternalInterface 需要 Internet Explorer ActiveX、Firefox、Mozilla 1.7.5 和更高版本,或其他支持 NPRuntime 的浏览器。
我做错了什么?
【问题讨论】:
-
ExternalInterface是与环境通信的,也就是当前Flash内容的external:一个包含Flash电影的网页,一个应用程序运行 Flash 内容等。 HTMLLoader 是一个 internal 对象,而不是外部环境。
-
在这种情况下也使用了它,正如本文中提到的 stackoverflow.com/questions/35956597/… Dodger Thud 评论并提到了 help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/… 但 adobe 已阻止伊朗 ips 然后我无法访问文档
-
在 Adobe AIR 中,ExternalInterface 类可用于在 HTMLLoader 控件中加载的 HTML 页面中的 JavaScript 与该 HTML 页面中嵌入的 SWF 内容中的 ActionScript 之间进行通信。
-
当我将标题设置为桌面项目时,它会在 swf 中加载一个 html 页面
标签: actionscript-3 flash air