Marlon Tomera
Marlon Tomera

Reputation: 1

CS3 Flash - Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found

The .swf files are in my library and on my hard drive, why is it saying it can't find them?

import flash.display.Loader;
import flash.events.MouseEvent;
import flash.net.URLRequest;

var myLoader:Loader=new Loader();
myLoader.x = 0;
myLoader.y = 100;

btn1.addEventListener(MouseEvent.CLICK, movie1);
function movie1(myevent:MouseEvent):void{
    var myURL:URLRequest=new URLRequest("Phase1IP.swf");
    myLoader.load(myURL);
    addChild(myLoader);
}

btn2.addEventListener(MouseEvent.CLICK, movie2);
function movie2(myevent:MouseEvent):void{
    var myURL:URLRequest=new URLRequest("Phase2IP.swf");
    myLoader.load(myURL);
    addChild(myLoader);
}


btn3.addEventListener(MouseEvent.CLICK, movie3);
function movie3(myevent:MouseEvent):void{
    var myURL:URLRequest=new URLRequest("Phase3IP.swf");
    myLoader.load(myURL);
    addChild(myLoader);
}

Upvotes: 0

Views: 8829

Answers (2)

BadFeelingAboutThis
BadFeelingAboutThis

Reputation: 14406

  1. Make absolutely certain your file path is correct. If you don't supply a path to a URLRequest, it will assume the resource is in the same directory as the current .fla you're working with (or more precisely wherever you have the .swf publishing to, which by default will be the same directory as the .fla).

  2. Make sure your security sandbox settings are correct.

    To check them, go to your publish settings, under "ADVANCED" there should be a select box labeled "Local Playback Security" - make sure this is set to "Access Local Files Only"

  3. Save yourself the headache next time and listen for the appropriate potential errors before loading a file:

    loader.addEventListener(Event.COMPLETE, onComplete);
    loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError); 
    loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); 
    loader.load(request);
    

Upvotes: 0

bcrowell
bcrowell

Reputation: 507

Try adding an event listener to your myLoader to catch IO errors. In the following example (which should not be used in Production) I'll simply trace the full URL of the file that ActionScript thinks is missing to the console...

var myLoader:Loader=new Loader();
myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function(ioError:IOErrorEvent){
  trace(ioError.text);
});

Now, when you click on your button, your console should display something like...

Error #2035: URL Not Found. URL: file:///C|/.../Phase1IP.swf

If you determine that Phase1IP.swf is located at the URL traced to the console it still won't load, there may be another issue to explore.

Upvotes: 2

Related Questions