Hello,
I am loading multiple images into a class instance and I would like to keep track of how large the complete amount of loaded data is at any given point. I have grabbed the totalbytes from my directory of images via a PHP script... but collecting the new bytes from the ProgressEvent on each image seems tricky for some reason. Let's assume that the totalBytes variable is correct and that I am totally unfamiliar with the way that ProgressEvent works...
Does an event get fired every time ProgressEvent gets a new byte?
If not, how do I keep track of the current total bytes?
I'm sure I've got it wrong, but here's what I am trying:
public function thumbProgress(e:ProgressEvent):void
{
//trying to check for a new data amount, in case the progress event updates
//insignificantly
if(e.bytesLoaded != this.newByte)
{
this.newByte = this.currentLoadedBytes - e.bytesLoaded;
this.currentLoadedBytes += this.newByte;
this.textprog.text = this.currentLoadedBytes.toString() + " / " + this.totalBytes.toString();
this.newByte = e.bytesLoaded;
}
if(this.currentLoadedBytes >= this.totalBytes)
{
this.textprog.text = "done loading.";
}
}