9/14/2011 9:21:26 PM
Title:
Could someone help me resolve error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Com
Dear friends, when I try to load a single child swf in parent swf using the following code and simulate download, my preloader shows progress, it goes from 0% to 100% and plays animation located on next frame.
CODE IN PARENT SWF:
var myLoader:Loader = new Loader ();
var myRequest:URLRequest = new URLRequest("clip4.swf");
myLoader.load(myRequest);
stage.addChild(myLoader);
CODE IN CHILD SWF:
addEventListener(Event.ENTER_FRAME, loaderF);
function loaderF(e:Event):void {
var toLoad:Number=loaderInfo.bytesTotal;
var loaded:Number=loaderInfo.bytesLoaded;
var total:Number=loaded/toLoad;
if (loaded==toLoad) {
removeEventListener(Event.ENTER_FRAME, loaderF);
gotoAndStop(2);
} else {
preloader_mc.preloaderFill_mc.scaleX=total;
preloader_mc.bytesPercent.text=Math.floor(total*100);
}
}
}
But when I try to load an array of child swf's using the following code and simulate download, my preloader does not work, i.e., does not go from 0% to 100% and output shows: error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
CODE IN PARENT SWF:
var clips:Array=["clip0.swf","clip1.swf","clip2.swf","clip3.swf"];
var index:int=0;
var swf_no:Number=0;
// Stuff to load swf files
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
var thisMC:MovieClip = new MovieClip();
var thisRequest:URLRequest = new URLRequest((clips[index]));
thisLoader.load(thisRequest);
stage.addChild(thisMC);// Add empty MC initially so the nextClip function can be generic
function doneLoading(e:Event):void {
thisMC.stop();
stage.removeChild(thisMC);
thisMC=MovieClip(thisLoader.content);
thisLoader.unloadAndStop();
stage.addChild(thisMC);
thisMC.play();
}
CODE IN CHILD SWF:
Same as above.
My guess is it is happening because here I am loading my child swf's in an empty movieClip, I searched a lot on the net, as guided there, I further traced it using following code:
thisLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
function errorHandler(e:IOErrorEvent):void {
throw new IOError(e.text);
}
I got this in output panel:
Error: Error #2036: Load Never Completed. URL: file:///C|/Users/san/Desktop/greatPlayer/clip4.swf
at testingPreloader_fla::MainTimeline/errorHandler()
at flash.display::Loader/_unload()
at flash.display::Loader/unloadAndStop()
at testingPreloader_fla::MainTimeline/doneLoading()
I am new to flash, how can I make the preloader work? what changes should I make in the code so that preloader works? how can I reference preloader from a dynamic empty parent movieclip, can someone guide me as to how I can get the preloader working? thanks in advance, any help would be appreciated.
Rohit
Points: 160
Posts:0
10/24/2011 5:18:15 AM
Make sure you have all the swf files whre your swf file is exists
try one more thing
instead of :-
var thisRequest:URLRequest = new URLRequest((clips[index]));
try this :-
var thisRequest:URLRequest = new URLRequest(clips[index]);