這裏StageWebView中不能引用您在使用loadURL給出的URL( ),因爲applink是通過文檔中的單斜槓獲得引用的。但我無法嘗試使用applink。 StageWebViewBridge不會在其覆蓋受保護的addEventListener函數中處理ErrorEvent。如果您需要處理這個錯誤事件,你應該添加
override public function addEventListener(type : String, listener : Function, useCapture : Boolean = false, priority : int = 0, useWeakReference : Boolean = false) : void
{
switch(type)
{
case ErrorEvent.ERROR:
case Event.COMPLETE:
case LocationChangeEvent.LOCATION_CHANGING:
case LocationChangeEvent.LOCATION_CHANGE:
case FocusEvent.FOCUS_IN:
case FocusEvent.FOCUS_OUT:
_view.addEventListener(type, listener, useCapture, priority, useWeakReference);
break;
default:
super.addEventListener(type, listener, useCapture, priority, useWeakReference);
break;
}
}
,也需要刪除的聽衆喜歡,
override public function removeEventListener(type : String, listener : Function, useCapture : Boolean = false) : void
{
switch(type)
{
case ErrorEvent.ERROR:
case Event.COMPLETE:
case LocationChangeEvent.LOCATION_CHANGING:
case LocationChangeEvent.LOCATION_CHANGE:
case FocusEvent.FOCUS_IN:
case FocusEvent.FOCUS_OUT:
_view.removeEventListener(type, listener, useCapture);
break;
default:
super.removeEventListener(type, listener, useCapture);
break;
}
}
現在可以處理的ErrorEvent通過
webView.addEventListener(ErrorEvent.ERROR, onLoadURLErrorTriggered);
和,你總是最好給文件的URL加載本地html文件,如
var file : File = new File("file-path");
webView.loadURL(file.url);