preloader help pls
hi all i have a burning question which i really need an answer to,
basically i have a preloader and i want it to load each section when called with this code:
callback function////////////////////////////////////////////////////////////////////////////////////////////
caps_mc.btn_continue_mc.addEventListener(MouseEvent.CLICK, nextpls);
function nextpls(e:MouseEvent):void {
MovieClip(parent.parent).nextSWF("startPage", parent);
}
the code above tells the preloader that it is finished with the startPage and in the preloader it should next load faq,
but i get an error saying that nextSWF is not a function when it clearly is,
is it even possible to use a preloader to load up swfs in this way??
preloader///////////////////////////////////////////////////////////////////////////////////////////////////////
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
var loadedSWF:Loader
var progressPercent:Number;
function startLoad(SWFName:String):void {
loadedSWF = new Loader();
loadedSWF.contentLoaderInfo.addEventListener(Event.COMPLETE, gameLoaded);
loadedSWF.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
loadedSWF.load(new URLRequest(SWFName+".swf"));
}
//track progress
function onProgressHandler(loadingProgress:ProgressEvent){
var percent:Number = loadingProgress.bytesLoaded/loadingProgress.bytesTotal;
progressPercent = Math.round((percent*100));
preload_mc.gotoAndStop(progressPercent);
preload_mc.myloadtext_txt.text=(progressPercent + " %")
preload_mc.myloadbar_mc.scaleX = percent;
preload_mc.mc_mask.height=(progressPercent * 3);
preload_mc.ofBytes_txt.text = loadingProgress.bytesLoaded + " bytes";
preload_mc.totalbytes_txt.text = loadingProgress.bytesTotal + " bytes";
}
function gameLoaded(e:Event):void{
removeChild(preload_mc);
this.addChild(loadedSWF);
loadedSWF.contentLoaderInfo.removeEventListener(Event.COMPLETE, gameLoaded);
loadedSWF.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgressHandler);
}
function nextSWF(whichSWFName, removeSWF){
this.removeChild(removeSWF.parent);
if(whichSWFName == "startPages"){
startLoad("faq");
}
}
startLoad("startPages");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
here is the error
TypeError: Error #1006: nextSWF is not a function.
at startPages_fla::MainTimeline/nextpls()[startPages_fla.MainTimeline::frame1:7]
if anyone can help i would be most grateful, i am hoping to be able to have a re-useable preloader
thanks in advance
fonzio