当我试图在StageWebViewBridge容器上加载一个本地html时,我会得到这个错误:
错误#2044:未处理的ErrorEvent:。text=Load误差
代码:
private function onDiskCacheEnd( e:StageWebviewDiskEvent ):void{
bridge = new StageWebViewBridge( 0, 0, 1280, 720 );
bridge.loadLocalURL('applink://index.html');
...index.html位于www文件夹中。
谢谢!
发布于 2014-02-25 02:03:51
实际上从未尝试过这种方法,但是文档(https://code.google.com/p/stagewebviewbridge/wiki/ContentLoading)只使用一个斜杠。
所以,而不是:'applink://index.html‘
文档使用:"applink:/index.html“
发布于 2014-05-27 05:56:04
这里,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 );https://stackoverflow.com/questions/15945088
复制相似问题