Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: PureMVC Loadup Util giving fluctuating progress percentage  (Read 7535 times)
inchworm
Jr. Member
**
Posts: 13


View Profile Email
« on: March 09, 2010, 08:30:17 »

I've been working with the Loadup for Assets demo and I'm getting some strange returns in my test project. Currently I'm loading an xml file, 2 jpegs and a swf. Loadup loads the xml file first and sets its progress percent at 25%. It then briefly ticks up to 26.32577979788008% before immediately dropping off to 9% and then counting back up to 100%. Below is the output from the console so you can see the notes that are being sent and the progress percentage. I thought that the util was supposed to count up to 100% for an entire group of assets. Am I missing something? (apologies for the long line lengths).

*Edit: I've noticed that it will also tick up to 100%, then down to around 75% to finish another asset and then tick back up to 100%*

——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: ApplicationNotifications.STARTUP
——————————————————————————————————————————————————————————————————————————————————
[object StartupCommand] running...
[object ApplicationMediator] created
[object ApplicationMediator] onRegister


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: LOAD_ASSET_GROUP
——————————————————————————————————————————————————————————————————————————————————


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=25


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luNewAssetAvailable
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
xml/site_data.xml


—————————————————��————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=25


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetLoaded
——————————————————————————————————————————————————————————————���———————————————————


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luLoadingProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Loading Progress: 25%


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
————————————————————���—————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=26.32577979788008


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=9.233931554644707


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
———————————————————————————————————���——————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=18.462746629577666


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=43.12657278943433
« Last Edit: March 09, 2010, 08:36:35 by inchworm » Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #1 on: March 10, 2010, 04:37:50 »

For a group of assets, to be loaded via the asset loader facility, Loadup prefers to calculate the percent loaded on the basis of bytes loaded versus the total to be loaded, as opposed to a simple number of assets loaded versus the total number of assets.  It relies on the information provided by the ProgressEvents that occur within the load process for each asset.  However, the bytes total (total size) for an asset can only be known when loading of that asset has commenced.

The loading occurs asynchronously; several assets can be undergoing load simultaneously.  However, until all of the loads have commenced, the overall total bytes is not known, and hence progress on the exact bytes basis cannot be reported.  So, until that point has been reached, the percentage is calculated on the basis of  the percent loaded per asset, averaged across the total number of assets.  For example, assets A,B,C,D.  A is 75% loaded, B is 25% loaded, C and D not started.  The reported progress percentage is (75+25)/4 = 25%.  Then, when C and D have started, the reported percentage is based on the exact bytes.  Now, if C and D turn out to be large relative to A and B, a drop in the reported percentage will be observed.

If a progress percentage, based on number of assets loaded versus the total number of assets, is preferred, use the Loadup.LOADING_PROGRESS notification instead of the Loadup.ASSET_GROUP_PROGRESS notification.

Hope this helps.
----Philip
Logged
inchworm
Jr. Member
**
Posts: 13


View Profile Email
« Reply #2 on: March 11, 2010, 12:01:19 »

Thanks for the quick response :D I appreciate you taking the time to explain that to me.
Logged
Pages: [1]
Print