gradient
 
gradient
 
 
 
 
title

13. Loading External Movie

title
sign
 

 

Our Flash templates have a main movie that contains the main graphic elements and other movies for the content pages. So the index.fla file (template/flash) is the source of the main movie, the "home.fla" (template/flash) is the source for the first page that automatically loads, the "content.fla" (template/flash) is the source for the other pages that you load using the buttons.

So in our example template we have a main movie (index.swf) and 4 other movies (home.swf, services.swf, partners.swf, contacts.swf) that are loaded using buttons or directly from the main movie (this is the case of the home.swf movie that is loaded using Actionsript at a specific keyframe in the animation. After that it will be loaded only using the Home button)

Now let's see how we can load these external movies from our main movie.

Open the file index.fla from template/flash.

Go to the "loadmov" layer in the Timeline. As you can see it has a keyframe with some actions inside.

Select that keyframe and take a look at the Actions palette. Here we have the actions that load the external movie "home.swf":

As you can see we use "loadMovieNum" action to load an external movie. You must specify the path to that movie. If it is in the same directory with the main movie just write its name (for example "home.swf). The number "1" after the path to the movie we wish to load represents the level in which it will be loaded. By default the main movie has the level 0. If you load a movie to the level 1 it will be placed over the main movie covering it. And that's what we want.

Now let's see how we can load external movies using buttons. Go to the Library and double click the movie clip symbol "home" to edit it. In the new window select the invisible button and take a look at the Actions palette:

As you can see above we use the same loadMovieNum action to load the home.swf movie but this time this action depends on another action: the "on()" action. The "on()" action is set to "release" so that the loadMovieNum action to occur only in case that you click on the button and release the mouse button.