Hi
I am having truble integrating child swf loaders in to main swf loading. I read docs and it should work by default but i can no get it to work. My parent swf fires its complete event before child swf finishes with its loads. My setup is as like this:
index.swf that contains following code:
pageLoaderMax = new LoaderMax({name: "pageLoaderMax", onComplete: pageLoaded, requireWithRoot:this.root});
pageLoaderMax.append( new SWFLoader("page.swf", {name:"pageLoader", container: pageHolder, requireWithRoot:this.root }) );
pageLoaderMax.load();
} ////preloaderLoaded
function pageLoaded(evt:LoaderEvent):void
{
trace("PAGE LOADED");
}
This swf is only responsible for loading page swf that contains multiple SWF loaders inside one LoderMax, like this:
mainPartsLoader = new LoaderMax({name:"mainPartsLoader", onComplete: mainPartsLoaded, onProgress: progressHandler, requireWithRoot:this.root});
mainPartsLoader.append( new SWFLoader("swfs/background.swf", {name: "bg", container: bgHolder, y: 0, requireWithRoot:this.root}) );
mainPartsLoader.append( new SWFLoader("swfs/blueBar.swf", {name: "blueBar", container: blueBarHolder, y: 630, requireWithRoot:this.root}) );
mainPartsLoader.append( new SWFLoader("swfs/btnPortfolio.swf", {name: "btnPortfolio", container: buttonsMainHolder, requireWithRoot:this.root, x: 328, onComplete: btnLoaded}) );
mainPartsLoader.append( new SWFLoader("swfs/btnFoto.swf", {name: "btnFoto", container: buttonsMainHolder, requireWithRoot:this.root, x: 439, onComplete: btnLoaded}) );
mainPartsLoader.append( new SWFLoader("swfs/btnInfo.swf", {name: "btnInfo", container: buttonsMainHolder, requireWithRoot:this.root, x: 550, onComplete: btnLoaded}) );
mainPartsLoader.append( new SWFLoader("swfs/btnArhiv.swf", {name: "btnArhiv", container: buttonsMainHolder, requireWithRoot:this.root, x: 662, onComplete: btnLoaded}) );
mainPartsLoader.append( new SWFLoader("swfs/btnReel.swf", {name: "btnReel", container: buttonsMainHolder, requireWithRoot:this.root, x: 773, onComplete: btnLoaded}) );
mainPartsLoader.load();
function mainPartsLoaded(evt:LoaderEvent):void
{
trace("all content loaded");
}
function progressHandler(event:LoaderEvent):void
{
// trace("progress: " + event.target.progress * 100);
}
function btnLoaded(evt:LoaderEvent):void
{
trace(evt.target.name);
//trace("btnLoaded");
}
But it does not work and parent swf (index ) gives me eventComplete before child swf finishes and i get traces for actual swfs inside child(page) after i get trace that index.swf (my parent swf) has event.complete.
I hope that my explanation makes some sense.
So what am i doing wrong. Why do i not get event.complete from parent last?
Luka