Title: Load Movie
Author: AEvision
Difficulty: Intermediate
Prerequisites: Creating Buttons

In this toturial, you're going to learn how to load external swf files to your main swf and set a specific position for it.

A Flash file consists of different levels. The main file is considered Level 0. Imagin the level as one of Photoshop layers on which you can have different objects. In this case, levels can hold your different swf files.


LoadMovie action is a simple one, here's an example of how it looks like: loadMovieNum("yourfile.swf", 1);

That action loads a file called yourfile.swf and places it on level 1.


Now the question is, where is that movie going to be positioned on the main movie clip? Can we force the loaded movie to be placed wherever we want?


This tutorial is going to answer that. We're going to do that following 2 methods, one with Flash5 and the other with FlashMX.


Using Flash 5


Even if u are using Flash MX, I highly recommend you understand the mothod used for Flash 5 as this will give you a better idea of how it works.

  • Ok, start by creating your buttons, one for loading a movie and the other one for Unloading a movie.

We are going to use a movie clip on the main file and use it as a target to be replaced by the loaded movie.

  • Therefore, create a movie clip as shown in Fig1, name the Instance "area" (in the prperties bar). It doesn't have to be of any specific shape, cause this is just for demonstration to show you that there's a movie clip there on the stage. We are going to remove the object from the movie clip later.


Ok, good. Now right-click the button for loading a movie, go to actions and add the following action:

on (release) {
loadMovie("content.swf", "area");
setProperty("area", _y, "45");
setProperty("area", _x, "12");


What does that do?

  • On release, the file called content.swf will be loaded and will replace the target movie clip we called area.

Now observe Fig 2, here's what happens normally:


If you click the movie clip on the stage, you'll notice a ( + ) in the middle. The top left of your external movie will be placed in the center of the Movie Clip on the main stage, as shown in Fig 2

  • By using the setProperty action, we are going to reposition the target movie clip, as a result the loaded movie will be repositioned as well.

The horizontal ruler represents the X value, and the vertical represents the Y value. You can choose wherever you want your loaded movie to be placed by changing those values!


Now only thing is left is to remove the circle from the movie clip, you don't want your movie to start with a weird circle in the middle. So, double click the movie clip, and remove the circle from the movie clip. We could have started by creating an empty movie clip anyway, but like i said this was just for demonstration.

  • To unload the movie, add the following action to your unload button:

on (release) {

Nice hu? :D


Using FlashMX

On the next page we will see how simple this can be when using Flash MX :)


Fig 1












Fig 2






1 | 2 | Next

Main | Tutorials | BestFlash | Goodies | Forums | Portfolio | Contact Us
AEvision Tutorials 2.1 - All rights reserved AEvision Designs 2002-2007
Icons provided by iconpacks.com