Getting number of bytes of a bitmap
Goal is to show progress of jpeg encoding from bitmap. I have couple of
bitmaps that need to be encoded. So I get the total number of bytes as was
suggested here:
for (var i:int = 0; i < bitmaps.length; i++)
{
bmp = bitmaps[eobj.currentImage];
total_bytes += bmp.getPixels(bmp.rect).length;
}
Then I'm trying to show progress when doing asychronous encoding. I get a
ProgressEvent which gives me bytesLoaded. So I calculate the progress like
so:
total_loaded_bytes += event.bytesLoaded;
var percentage:int = ((total_loaded_bytes / total_bytes) * 100);
However, total_bytes does not add up to total bytes loaded. Total bytes
loaded is way highter.
No comments:
Post a Comment