PDA

View Full Version : Internal Preloader problem!



anix
July 31st, 2008, 04:43 AM
Hi all i bet you are getting sick of these preloader questions now but i really need this sorting, i have been trying to make a preloader that will work when i am loading a swf file inside another swf file. basically i have my main swf file that loads in image swf files into a holder movie clip on the stage. i need to make a preloader anim that runs and shows the progress on the loaded image. i ahve tried doing a 2 frame preloader in the image swf i have tried making a seperate preloader swf and now i have decided to just try and put the preloader in my main swf file cos the other mothods seemed to not work. I believe my code below is ok but i get an error and the animation is not playing through. the error i get is:

"TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-179()"

my code is below for the button click if any1 can please help me with this i would much appreciate it thanks.

YOU CAN ALSO CHECK OUT WHERE IM UP TO WITH IT AT http://www.sg-crysis.com/modelviewer/sgc%20model%20viwer.html TO SEE WHAT I MEAN.


import flash.events.Event;
import flash.events.ProgressEvent;

p90bttn.addEventListener(MouseEvent.CLICK, p90Load);

function p90Load(evt:MouseEvent):void {
var pageLoader:Loader = new Loader();
var pageURLReq:URLRequest = new URLRequest ( "swf/p90.swf");
var loaderMc:MovieClip = new loader();

pageLoader.load(pageURLReq);

pageLoader.contentLoaderInfo.addEventListener(Even t.OPEN,showPreloader);
pageLoader.contentLoaderInfo.addEventListener(Prog ressEvent.PROGRESS,showProgress);
pageLoader.contentLoaderInfo.addEventListener(Even t.COMPLETE, imageLoaded);

function showPreloader(evt:Event):void {
holder.addChild(loaderMc);
}


function showProgress(_prog:ProgressEvent):void
{

var percent:Number = Math.round(_prog.bytesLoaded/_prog.bytesTotal*100);

//info_txt.text = percent.toString()+' %';

holder.loaderMc.gotoAndPlay(percent);
}



function imageLoaded(evt:Event):void {

holder.removeChild(loaderMc);
holder.addChildAt(pageLoader.content, 1 );
holder.removeChildAt(2);
}
}