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之間進行通信。 –