Hi Adrian,

thanks for the idea but this approach will not work in my case because the images are loaded sequencially. If one image is finished loading, my class starts loading the next and so on, one after one. And the amount of images varies (the image filenames are fetched from a XML file). I'm now defining a segmentWidth by dividing the full progressbar width by the amount of images that are going to be loaded. That gives me the 100% for one image on the whol bar. I just haven't figured out yet how to make it work so that the bar doesn't start from 0 at every image. Any other idea?

Sascha





----- Original Message ----- From: "Adrian Park" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Sunday, March 12, 2006 3:24 AM
Subject: Re: [Flashcoders] Loading several images with one progressbar?


Say you have 3 images loading, use something like this:

var bytesLoaded:Number = 0;
var bytesTotal:Number = 0;

bytesLoaded += image1.getBytesLoaded();
bytesTotal += image1.getBytesTotal();
bytesLoaded += image2.getBytesLoaded();
bytesTotal += image2.getBytesTotal();
bytesLoaded += image3.getBytesLoaded();
bytesTotal += image3.getBytesTotal();

var percentageLoaded:Number = (bytesLoaded/bytesTotal) * 100;

There may be ways to optimise this code depending on your circumstances (e.g.
just calculate bytesTotal once and reuse it) but this shows the basic idea.

Adrian P.


On 3/11/06, Sascha Balkau <[EMAIL PROTECTED]> wrote:

Hi,
this is probably an old hat but I can't get it right. I want to display
the
load progress of several images with one progress bar. How do I calculate
the percentage of the bar?

Thanks alot,
Sascha

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to