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

泄露秘密 提交于 2019-12-13 21:12:32

问题


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);
}

回答1:


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.




回答2:


  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);
    


来源:https://stackoverflow.com/questions/25873133/cs3-flash-error-2044-unhandled-ioerrorevent-text-error-2035-url-not-foun

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!