2
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
}
使用ExternalInterface的,但我得到这个错误: 错误:错误#2067:ExternalInterface的是不是在这个容器中使用。 ExternalInterface需要Internet Explorer ActiveX,Firefox,Mozilla 1.7.5或更高版本,或其他支持NPRuntime的浏览器。AS3空气桌面上的HTMLLoader
我做错了什么?
** **的ExternalInterface与沟通环境,对于当前的Flash内容,这完全是** external **:包含Flash影片的网页,运行Flash内容的应用程序等等。 ** HTMLLoader **是一个**内部**对象,而不是外部环境。 – Organis
它在这种情况下也使用,如本文所述https://stackoverflow.com/questions/35956597/how-do-i-communicate-between-js-and-as3-in-an-air-android-application Dodger Thud评论并提到http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html,但Adobe已封锁irans ips,然后我无法访问文档 –
在Adobe AIR ,可以使用ExternalInterface类在HTMLLoader控件中加载的HTML页面中的JavaScript与HTML页面中嵌入的SWF内容中的ActionScript之间进行通信。 –