Jump to content
Search Community

LoaderMax.progress Doesn't Dispatch Overall Progress

RedGiant test
Moderator Tag

Recommended Posts

I want an overall progress on LoaderMax, but instead LoaderMax dispatches the individual progress of each of it's child loaders.

 

I append an XMLLoader that contains a LoaderMax with a load="true". The LoaderMax loads the XML and displays the XMLLoader progress. Then the LoaderMax loads the XMLLoader's LoaderMax node, displaying the progress of that LoaderMax. It doesn't seem to integrate the progress into a whole progress.

 

It seems like there is an easy solution that I just haven't come across yet.

 

AS3

LoaderMax.activate([xmlLoader, VideoLoader,ImageLoader]);

var initialload:LoaderMax=new LoaderMax({name:"initialLoad",onProgress:onLoadingProgress,onComplete:loadermaxCompleteHandler});
initialload.append(new XMLLoader("../bin/xml/mediacontent.xml",{name:"media"}));
initialload.load();

private function onLoadingProgress(event:LoaderEvent):void {
trace("PROG",event.target.progress,event.target.rawProgress);

//this is where it finishes loading what I believe is the XML, and then restarts on the XMLLoader's LoaderMax node
//output  PROG 0.9795634402991564 0.9795634402991564
//output  PROG 0.9899991303591616 0.9899991303591616
//output  PROG 0.051803897199684965 0.051803897199684965
//output  PROG 0.08571744541615028 0.08571744541615028
}

 

 

XML







Link to comment
Share on other sites

You forgot to define an estimatedBytes for your XMLLoader that includes the nested ImageLoaders. It would be absolutely impossible for LoaderMax to know what's inside the XML file before loading it nor could it know how big all those ImageLoaders are - that's the great thing about being able to define an estimatedBytes.

 

So the reason the progress seemed very high and then jumped to a lower value was because at first it only was concerning itself with the XML file itself, but once that loaded, it suddenly discovered all these nested ImageLoaders and had to audit their file size. Once it did that, it automatically adjusted the progress to include those too.

 

To make it even faster, I'd recommend defining estimatedBytes for each of your ImageLoaders too so that it never needs to audit those sizes. That's not necessary though. But I would certainly recommend defining estimatedBytes on your XMLLoader.

 

Make sense?

Link to comment
Share on other sites

Make sense? It makes a lot of sense! Thank you.

 

I read into estimatedBytes and even played around with the interactive tool created to demonstrate its power, but I never realized that it was what LoaderMax used to get an overall progress of the LoaderMax, its children, and grandchildren. I thought estimatedBytes was used to make progress super-accurate as opposed to just accurate.

 

Superb job!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...