Hi,
First of all let me congratulate you on creating such an excellent product. I am using it currently, and I must say, its one of its kind and saves me so much time!!. Many thanks.
Here's the problem I am facing. Its not a bug at all, its just that I am unable to get it to function the way that I want it to.
I have a parent file called "index.swf". In this upon a click of a button, I am trying to load another SWF called, lets say "child.swf".
Please keep in mind that child.swf loads an XML file which has images. I am using loaderMax within child.swf to preload my XML and its images as well. Works great. The child.swf loader queue has "requireWithRoot" set properly, and it does function as advertised with the index.swf file.
The problem I am facing is that there is a "PRELOADER BAR" in my index.swf, which scales up (on x) as it loads the child.swf. The issue is that first it loads the child.swf and it scales up to 100%, when it does so. All good so far. But, now when it starts to load the XML and the images of the child.swf, it shoots back to 0%, and then it progresses again.
Where i need help is that the preload bar should show cumulative progress, rather than jumping to 100% first and then shooting back to 0% and then jumping to 100% again. Its very confusing for the end user.
Is this something that you can help me with?. Again, any help would be greatly helpful. I am posting snippets of code below, maybe it can help. I cannot post the files here, since they are mostly complete.
HERE'S THE LOADER MAX CODE IN THE PARENT FILE : (index.swf) :
var queue:LoaderMax = new LoaderMax({name:"mainer", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
queue.prepend( new SWFLoader("child.swf", {name:"mainClip", container:cHolder, x:0, autoPlay:false}) );
queue.load();
function progressHandler(event:LoaderEvent):void {
faderBox.loadBar.scaleX = event.target.progress;
trace("progress: " + event.target.progress);
}
function completeHandler(event:LoaderEvent):void {
loaded = true;
TweenLite.to(faderBox.loadBar, 0.6, {scaleX:0, ease:Expo.easeOut});
TweenLite.to(faderBox.header, 2, {y:10, ease:Expo.easeOut});
TweenLite.to(faderBox.lineTop, 2, {y:faderBox.header.height , ease:Expo.easeOut});
TweenLite.to(faderBox.lineBottom, 2, {y:stage.stageHeight- 30 , ease:Expo.easeOut});
}
function errorHandler(event:LoaderEvent):void {
trace("error occured with " + event.target + ": " + event.text);
}
HERE IS THE CODE IN THE CHILD SWF (child.swf) :
var queue:LoaderMax = new LoaderMax({name:"mainQueue", requireWithRoot : this.root, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});
var picCount:Number = 0;
var req:URLRequest = new URLRequest("XMLS/works.xml");
queue.append( new XMLLoader(req, {onInit:processXML}) );
queue.load();
var works:XMLList;
var workstotal:Number;
function processXML(e:LoaderEvent):void {
var myXML:XML = new XML(e.target.content);
works = myXML.work;
workstotal = works.length();
numRows = 2;
numCols= Math.ceil(workstotal/numRows);
trace("Number of Rows : "+ numRows +" , Number of Columns : " + numCols);
for (var i:Number = 0; i < works.length(); i++)
{
picturePath = works[i].@thmb.toString();
subPicArray.push(new Array());
subPicArray[i][0] = works[i].@scr1.toString();;
subPicArray[i][1] = works[i].@scr2.toString();;
subPicArray[i][2] = works[i].@scr3.toString();;
subPicArray[i][3] = works[i].@scr4.toString();;
h1[i] = works[i].@title1.toString();
h2[i] = works[i].@title2.toString();
queue.append( new ImageLoader(picturePath, {name:"photo" + i, scaleMode:"proportionalInside"}) );
}
queue.load();
}
function progressHandler(event:LoaderEvent):void {
trace("progress: " + event.target.progress);
}
function completeHandler(event:LoaderEvent):void {
}
And by the way, the XML is a straight forward XML, not a specific Loader MAX XML. Hope this makes sense.
If you need further information, please do let me know, I will be happy to provide it. Thanks a million for all the help and the product!!. Cheers.