View comments | RSS feed

MovieClip._framesloaded

Availability

Flash Player 4.

Usage

my_mc._framesloaded:Number

Description

Read-only property; the number of frames that have been loaded from a streaming SWF file. This property is useful for determining whether the contents of a specific frame, and all the frames before it, have loaded and are available locally in the browser. It is also useful for monitoring the downloading of large SWF files. For example, you might want to display a message to users indicating that the SWF file is loading until a specified frame in the SWF file has finished loading.

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 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

MovieClipLoader class


Comments


whiteroka said on Nov 16, 2004 at 10:23 PM :
the deprecated ifFrameLoaded function allows you to test for a loaded
frame in a specific scene AND lets you test for a frame by label. neither
of these situations are addressable by any non-deprecated action.
Francis Cheng said on Apr 21, 2005 at 8:21 AM :
ifFrameLoaded was deprecated because the intended use of the function was for creating preloaders, and ifFrameLoaded was limited in that respect because you cannot use an else statement with it. You are correct that you can't check for a frame by label with this method, but you can check for a loaded frame in a specific scene by doing a little math, since scenes are loaded in order and frames are numbered consecutively through scenes. So if you want to target frame 5 in the second scene loaded, you would check whether _framesLoaded is greater than or equal to 15.
If you would like to see the functionality of ifFrameLoaded resurrected in the future, please log a feature request on our feature request page:
http://www.macromedia.com/support/email/wishform/

 

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

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001501.html