Hi,
Thanks for this great utility and for the time spent in creating it!
I'm working on a project which has 3 swf, first swf_1 is a traditional preloader (not using loaderMax) which loads in swf_2, swf_2 shows some content (video, text again not using loaderMax) and ui and than when the user clicks some button I'm starting to load swf_3 USING SWFLoader.
swf_3, in itself, loads some xml (not using loaderMax), parses this xml and than creates a new LoaderMax and appends 100 (roughly) mp3 to it using requireWithRoot:this.root, my problem is that the progress is not shown on swf_2 and the SWFLoader on swf_2 doesn't seem to take in account the weight of the mp3 assets in swf_3.
I looked around and: tracing this.root from inside swf_3 gives me swf_3 as an object (should it bring back swf_2 to work?), I'm also using estimatedBytes:10067434 in SWFLoader (which is in swf_2).
Its worth noting that this is an ActionScript 3 project built in Flash builder, so I don't have frames, code outside of classes etc.
This is what's happening in swf_2:
//this is inside a class
private function skipVideo(event:MouseEvent):void{
videoPlayer.kill();
removeChild(videoPlayer);
removeChild(skipBtn);
//start the load
_swfLoader = new SWFLoader("../../ProjectName/Deploy/App.swf",
{ x:0, y:0, estimatedBytes:10067434, onComplete:_completeHandler } );
_progressDisplay = new ProgressCircleLite({radius:26, thickness:4, trackColor:0xFFFFFF, trackAlpha:0.25, trackThickness:4, autoTransition:false, smoothProgress:0});
this.addChild(_progressDisplay);
_progressDisplay.mouseEnabled = false;
_progressDisplay.x = 69;
_progressDisplay.y = 389;
_progressDisplay.addLoader(_swfLoader);
_swfLoader.vars.integrateProgress = true;
_swfLoader.load(true);
}
private function _completeHandler(event:LoaderEvent):void {
//add the SWFLoader's content to the stage
addChildAt(event.target.content, 0);
}
And this is what's happening in swf_3 (the loaded swf, which is also called App.swf in the above code):
//this is inside a class
private var xml:XML;
private var queue:LoaderMax = new LoaderMax();
public function App() {
//constructer
super();
this.addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(event:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, init);
loadXML();
buildUI();
}
private function loadXML():void{
var loader:URLLoader = new URLLoader;
loader.addEventListener(Event.COMPLETE, completeLoadingXML);
loader.load(new URLRequest("assets/assets.xml"));
}
private function completeLoadingXML(event:Event):void {
//parse XML
var result:XML = new XML(event.target.data);
trace(this.root.parent);
queue.vars = { name:"childQueue",
requireWithRoot:this.root,
maxConnections:1,
onChildComplete:_childCompleteHandler };
for ( var i:int = 0; i < result.instrument.length(); i++ ) {
queue.append( new MP3Loader( result.instrument[i].toString(),
{ name: result.instrument[i].@type.toString() + result.instrument[i].@chord.toString(),
volume: result.instrument[i].@volume,
requireWithRoot: this.root,
noCache: true,
autoPlay:false } ) );
}
queue.load();
}
Thanks!