
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
340
|
Chapter 13: Movie Clips
Load movie execution order
The loadMovie() function is not immediately executed when it appears in a state-
ment block. In fact, it is not executed until all other statements in the block have fin-
ished executing.
We cannot access an externally loaded movie’s properties or methods
in the same statement block as the loadMovie() invocation that loads it
into the Player.
Because loadMovie() loads an external file (usually over a network), its execution is
asynchronous. That is, loadMovie() may finish at any time, depending on the speed
of the file transfer. Therefore, before we access a loaded movie, we should always
check that the movie has finished transferring to the Player. We do so with what’s
commonly called a preloader—code that checks how much of a file has loaded
before allowing some action to take place. Preloaders can be built with the
_totalframes and _framesloaded movie clip properties and the getBytesLoaded() and
getBytesTotal() movie clip methods. See the appropriate entries under the MovieClip
class in the Language Reference for sample code.
Movie and Instance Stacking Order
All movie clip instances and externally loaded movies displayed in the Player reside
in a visual stacking order akin to a deck of cards. When instances or externally
loaded ...