Jump to content
GreenSock

Jason Miller

AuditSize Question

Recommended Posts

Hello...

 

I am curious if there is a way to auditSize on a LoaderMax instance prior to actually doing the load. In my app I am prompting the user with a confirmation dialog box that needs to state the size of the download, and then asks them to confirm if they want to continue, or cancel out.

 

Just curious if there is an easy way to handle this, or if it will require actually starting and stopping the download to get these numbers.

 

Thanks!

Link to comment
Share on other sites

Nevermind. A little digging through the source code and I found my answer.

 

This would definitely be helpful if documented somewhere, as well as maybe use the standard event such as LoaderEvent.AUDIT_COMPLETE or whatever.

 

Anyways, sorts me out and hopefully helps others.

 

loader.addEventListener("auditedSize", onAuditSize);
loader.auditSize();

private function onAuditSize (event:Event):void {
 trace(loader.bytesTotal);
}

  • Like 1
Link to comment
Share on other sites

I should also add that this event never fires if you have 0 items in your loader. In the event there is a potential of this (as in my case), make sure you are checking for this before setting the event listener.

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.
×