-
Preloader Error
I used the code below to make a preloader and it works fine when I try it locally, but gives me the following error when I try to use it in a website: "Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found." The preloader is a swf that pulls in another swf after it loads. Also when I use the swf that the preloader is pulling in, it also works. Any suggestions?
Code:
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("myswf.swf"));
function loop(e:ProgressEvent):void {
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}
function done(e:Event):void {
removeChildAt(0);
percent = null;
addChild(l);
}
-
maybe your myswf.swf file isn't located directly next to your preloader swf, because that where you are linking to right now.
If you've put it inside of a folder, try using:
l.load(new URLRequest("folderName/myswf.swf"));
If it's on a higher level, try:
l.load(new URLRequest("../myswf.swf"));
in which each ../ takes you up one level
-
It was a path issue. Thank you!
-