Movieclip.getbytesloaded() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

MovieClip.getBytesLoaded()

Availability
Flash Player 5.
Usage
my_mc.getBytesLoaded() : Number
Parameters
None.
Returns
An integer indicating the number of bytes loaded.
Description
Method; returns the number of bytes that have already loaded (streamed) for the movie clip
specified by
my_mc
MovieClip.getBytesTotal()
You can extend the methods and event handlers of the MovieClip class by creating a subclass. For
more information, see "Assigning a class to a movie clip symbol" in Using ActionScript in Flash.
Example
The following example uses the
are loaded. If all the frames aren't loaded, the
is increased proportionally to create a progress bar.
Enter the following ActionScript in Frame 1 of the Timeline:
var pctLoaded:Number = Math.round(this.getBytesLoaded()/
this.getBytesTotal()*100);
bar_mc._xscale = pctLoaded;
Add the following code to Frame 2:
if (this._framesloaded<this._totalframes) {
this.gotoAndPlay(1);
} else {
this.gotoAndStop(3);
}
Place your content on or after Frame 3. Then add the following code to Frame 3:
stop();
See also
MovieClip.getBytesTotal()
. You can compare this value with the value returned by
to determine what percentage of a movie clip has loaded.
_framesloaded
property to start a SWF file when all the frames
property of the movie clip instance
_xscale
MovieClip.getBytesLoaded()
loader
519

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents