
MovieClip.getBytesTotal() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
659
widely in size). See _framesloaded for example preloader code based on the number of
downloaded frames.
Usage
Unfortunately, in Flash 6, the return value of getBytesLoaded() reflects the uncompressed
size of Flash .swf files being loaded, not the size of the file after Flash compression has been
applied. This means that getBytesLoaded() for a .swf file with a post-compression size of
2,000 bytes might return, say, 10,000 bytes.
Example
The following code shows a simple preloader that displays download progress in two text
fields:
// CODE ON FRAME 1 OF A MOVIE'S MAIN TIMELINE
if (this._framesloaded > 0 && this._framesloaded = = this._totalframes) {
this.gotoAndPlay("beginMovie");
} else {
// Show the load progress in text fields. Divide by 1024 to convert bytes to KB.
loadProgressOutput_txt.text = Math.floor(this.getBytesLoaded()/1024);
loadTotalOutput_txt.text = Math.floor(this.getBytesTotal()/1024);
}
// CODE ON FRAME 2
this.gotoAndPlay(1);
See Also
loadMovie(), MovieClip._framesloaded, MovieClip.getBytesTotal(), MovieClip.loadMovie(),
MovieClip._totalframes, MovieClip.unloadMovie(), unloadMovie()
MovieClip.getBytesTotal() Method
check the size of a clip or movie, in bytes
Flash 5
mc.getBytesTotal()
Returns
An integer representing ...