View comments | RSS feed

getBytesTotal (MovieClip.getBytesTotal method)

public getBytesTotal() : Number

Returns the size, in bytes, of the movie clip. For movie clips that are external (the root SWF file or a movie clip that is being loaded into a target or a level), the return value is the uncompressed size of the SWF file.

You can extend the methods and event handlers of the MovieClip class by creating a subclass.

Availability: ActionScript 1.0; Flash Player 5

Returns

Number - An integer that indicates the total size, in bytes, of the movie clip.

Example

The following example uses the _framesloaded property to start a SWF file when all the frames are loaded. If all the frames aren't loaded, the _xscale property of the movie clip instance loader is increased proportionally to create a progress bar.

Enter the following ActionScript on Frame 1 of the Timeline:

var pctLoaded:Number = Math.round(this.getBytesLoaded()/this.getBytesTotal()*100);
bar_mc._xscale = pctLoaded;

Add the following code on 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 on Frame 3:

stop();

See also

getBytesLoaded (MovieClip.getBytesLoaded method)


Flash CS3


Comments


flashizzle said on Feb 8, 2008 at 6:01 PM :
It appears that when loading a .swf, getBytesTotal() doesn't work across
domains. So, when loading a .swf from domainB.com into a .swf from
domainA.com, getBytesLoaded() simply returns 0, and throws a security
warning in the trace window. Useless.

It appears we _must_ use the MovieClipLoader Object now if we want to
check progress while loading a .swf across domains.

Can anyone else confirm this?

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001916.html