Name
MovieClip._framesloaded Property — the number of frames of a clip or movie that have downloaded to the Player
Availability
Flash 4 and later
Synopsis
mc._framesloaded
Access
Read-only
Description
The integer _framesloaded property indicates how
many frames of mc have been loaded into
the Player (from
to mc
._totalframes). It
is normally used to create
preloaders that pause playback
until a sufficient number of frames have downloaded. For a movie
clip, the _framesloaded property always equals
_totalframes (because clips are loaded in their
entirety before playing) unless the instance is
in the process of loading an external .swf file
due to a loadMovie( ) invocation. The
_framesloaded property is, therefore, useful only
with main movies or external .swf files loading
into instances or levels.
Preloader code is traditionally placed directly on the main timeline of the movie being preloaded. A simple approach is to loop between frames 1 and 2 until the movie has loaded, at which point we go to the movie’s start frame. For example:
// CODE ON FRAME 1if (_framesloaded > 0 && _framesloaded == _totalframes) { gotoAndPlay("beginMovie"); }// CODE ON FRAME 2gotoAndPlay(1);
In Flash 5 and later, we may alternatively use the
enterFrame
movie clip event handler to build a
more portable preloader. In the movie we wish to preload, at the
frame where we want preloading to start, we invoke the
stop( ) function. Then we place a movie clip
with the following code on that movie’s timeline:
onClipEvent ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access