由网友(逝水无痕)分享简介:我用的是code和我得到一个错误消息:错误#2044:未处理IOErrorEvent :.文本=错误#2035:网址没有找到。VAR myLoader:装载机=新的Loader();的addChild(myLoader);VAR URL:的URLRequest =新的URLRequest(图库/ test.swf)...
我用的是code和我得到一个错误
消息:错误#2044:未处理 IOErrorEvent :.文本=错误#2035:网址 没有找到。
VAR myLoader:装载机=新的Loader();
的addChild(myLoader);
VAR URL:的URLRequest =新的URLRequest(图库/ test.swf);
myLoader.load(URL);
如何解决这一问题?
解决方案得添加监听器
VAR方面:的LoaderContext =新的LoaderContext();
context.checkPolicyFile =真;
VAR URL:的URLRequest =新的URLRequest(图库/ test.swf);
VAR myLoader:装载机=新的Loader();
myLoader.contentLoaderInfo.addEventListener(引发Event.COMPLETE,的onLoadComplete);
myLoader.addEventListener(AsyncErrorEvent.ASYNC_ERROR,errorHandlerAsyncErrorEvent);
myLoader.addEventListener(IOErrorEvent.IO_ERROR,errorHandlerIOErrorEvent);
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,errorHandlerSecurityErrorEvent);
myLoader.contentLoaderInfo.addEventListener(Event.INIT,initHandler);
myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,infoIOErrorEvent);
myLoader.contentLoaderInfo.addEventListener(使用ProgressEvent.PROGRESS,progressListener);
myLoader.load(URL,上下文);
myLoader.load(URL);
功能progressListener(E:ProgressEvent):无效{
跟踪(已下载+ e.bytesLoaded +出的+ e.bytesTotal +字节);
}
功能initHandler(五:事件):无效{
跟踪(负载INIT');
}
功能errorHandlerErrorEvent(E:的ErrorEvent):无效{
迹('errorHandlerErrorEvent'+ e.toString());
}
功能infoIOErrorEvent(E:IOErrorEvent):无效{
迹('infoIOErrorEvent'+ e.toString());
}
功能errorHandlerIOErrorEvent(E:IOErrorEvent):无效{
迹('errorHandlerIOErrorEvent'+ e.toString());
}
功能errorHandlerAsyncErrorEvent(E:将AsyncErrorEvent):无效{
迹('errorHandlerAsyncErrorEvent'+ e.toString());
}
功能errorHandlerSecurityErrorEvent(E:SecurityErrorEvent):无效{
跟踪(errorHandlerSecurityErrorEvent'+ e.toString(
));
}
功能的onLoadComplete(五:事件):无效{
跟踪('的onLoadComplete');
}
I use the code and I get an error
msg: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("gallery/test.swf");
myLoader.load(url);
How to fix this?
解决方案Gotta add the listeners
var context:LoaderContext = new LoaderContext();
context.checkPolicyFile = true;
var url:URLRequest = new URLRequest("gallery/test.swf");
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
myLoader.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandlerAsyncErrorEvent);
myLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandlerIOErrorEvent);
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandlerSecurityErrorEvent);
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, infoIOErrorEvent);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
myLoader.load( url,context );
myLoader.load( url);
function progressListener (e:ProgressEvent):void{
trace("Downloaded " + e.bytesLoaded + " out of " + e.bytesTotal + " bytes");
}
function initHandler( e:Event ):void{
trace( 'load init' );
}
function errorHandlerErrorEvent( e:ErrorEvent ):void{
trace( 'errorHandlerErrorEvent ' + e.toString() );
}
function infoIOErrorEvent( e:IOErrorEvent ):void{
trace( 'infoIOErrorEvent ' + e.toString() );
}
function errorHandlerIOErrorEvent( e:IOErrorEvent ):void{
trace( 'errorHandlerIOErrorEvent ' + e.toString() );
}
function errorHandlerAsyncErrorEvent( e:AsyncErrorEvent ) :void{
trace( 'errorHandlerAsyncErrorEvent ' + e.toString() );
}
function errorHandlerSecurityErrorEvent( e:SecurityErrorEvent ):void{
trace( 'errorHandlerSecurityErrorEvent ' + e.toString(
) );
}
function onLoadComplete( e:Event ):void{
trace( 'onLoadComplete' );
}
相关推荐
最新文章