Posts Tagged ‘LoaderInfo’


Showing Progress for Multiple Loaders

10.17.2009

A common thing to do in most any rich application is to show progress while loading remote assets. In ActionScript, the bytesLoaded and bytesTotal properties of classes such as LoaderInfo and URLLoader provide the needed information to show a fancy percentage-based progress indicator. The bytesLoaded property is updated as more and more of the asset is loaded in. Divide that by the bytesTotal and you have the percentage loaded.

Easy enough. How about multiple loaders? Lets say you have a group of 10 images and you’d like to show progress for all the images collectively. Because you have 10 different images you also have 10 different URLLoader instances (or Loader instances, whatever suits your fancy)–one for each image. Math would say that you divide the sum of bytesLoaded by the sum of bytesTotal and that gives you the percentage complete. Two issues arise: Continue reading »