How to fix the error: Error # 2044: Unhandled IOErrorEvent :. text = Error # 2035: URL not found

I use 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 it?

+3
source share
2 answers

I need to add 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' );
}
+6
source

you need to make sure that the directory / directory of directories exists relative to your .swf (and not your .fla) and that swf test.swf is inside this folder so that it can be downloaded. Check your publish settings (shift + f12) to make sure your swf publishes where you expect it to.

0
source

All Articles