Title
: Loading Movies
Level : Beginner
Author : Ernesto Quezada
Website : www.OverloadStudios.co.uk
Loading
Movies
With
this method, instead of having a movie with all we want
to show, we can divide our content into different movies
decreasing the loading time, so the users of our site would
watch the content more fast and only would load what is
requested.
We
have two options when using load movie:
- Loading on levels
- Loading in targets
Levels
Let's
create a movie and call it "mother",
by default the properties of our movie are 550x400 pixels,
12 frames per second, and is on level 0
Now let's create another movie with the name "son1".
We can create as many "sons" as we need, always
taking into consideration that the properties of the movie
"mother" would be inherited by
the "sons", so if you create
a movie with 24 frames per second, when
loading in "mother" the rate
will be 12 frames per second.
We should create the sons with the same dimension as the
mother but we will locate the elements according to our
needs, thinking like a trasparent sheet of paper that will
be placed over the sheet below.
The
code we need is:
loadMovieNum("son1.swf",
1);
"son1.swf"
is the name of the movie we want to be loaded, 1
means the level. Elements in higher level are hiding elements
in lower levels if are in the same location. We can add
this code in a frame depending on our needs, usually the
first frame or in an event of a button.
In
case we need another movie instead of "son1.swf"
we can load it on level 1.
If we want to load more movies besides "son1.swf"
we should load them on level 2, 3...
If we just want to unload any movie, the code is:
Let's
create an empty movie clip and call it "ourClip"
(instance name). We can locate it where we want the movies
to be loaded, remember, location is a mathematical thing
with axis "x" and "y" (0,0) and this
coordinate is at the right corner of the stage. The 0,0
of your movie "son1.swf" in this
case would be where we locate "ourClip".
The
code in this case is:
loadMovie("son1.swf",
"ourClip");
We
can load another movie instead using the same code but with
the name of the new movie. Using Target allow us to use
the different methods availables for the movieClip object
like swapdepths, visibility, alpha, etc.
If we need more movies, we can use more empty movie clips.