First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Mindaugas

We're gonna do it simple - no fancy stuff, just basics explained. So, if you need that a flash movie loads another flash movie in the right position - that's covered here.

Where did I needed? I'm designing a 100%-flash site with various types of information. One of the subsections had a few pages of text and some 14 pictures. Now we have a dillema here: if we combine everything under one umbrella, i.e. text and pictures in one swf movie, it's gonna be large (perhaps app. 1MB) - webpage will be laoding slowly. But that's a simple sollution, no headache. A more difficult one: separate the text and pictures into different movies - loading time decreased, since the text loads first (quickly) and a user has an option to check pictures (need to load another swf with pictures after clicking on "pictures" button). The main thing is that an impression of decreased loading time and option to choose is created. But that's a bit more sophisticated. It's done by laoding the swf movie with pictures into the text swf. How to do it right? Step by step answer bellow.



- empty movie clip.
- "parent" swf.
- "child" swf.


loadMovie() - Actionscript command, which loads the movie. Simple. The parameters in the brackets are used to tell 1) which movie to load and 2) where to load it.

unloadMovie() - Actionscrip command, which unloads the movie from cache. Typically, I don't use this command - once user has loaded the movie, it stays in the memory, so if he comes back - the movie will already be in the memory and could be immediatelly played (short - saves time). This command unloads the movie from the cache. You might need to use this command if your "child" movie overlaps with something in your "parent" movie.

empty movie clip - used to define location in the "parent" swf, where the "child" swf is loaded. Does not contain any information in it - it's blank. IMPORTANT - you have to add any instance name (in Flash MX in "Properties" - just type in), which will serve as a link defining location.

- "parent" swf. The movie you're working in, the movie into which you want to load the "child". (Text in my case)

- "child swf. The movie containing information, which you want to load into the "parent" swf. (Pictures in my case)


We will use the loadMovie() command to load the child into the parent. However, in flash this command ALWAYS loads the movie in the top left corner (0;0) of an object. If you're working in the Scene1 - that will look ugly, since all your text in "parent" will appear underneath the "child". The trick here is to use the empty movie clip, which calls this command - the movie will be loaded in the top left corner of the movie clip, i.e. in the position, where you have placed that empty movie clip. So, to define the position where the child should load, place the empty movie clip in the desired position in the parent swf. Simple.


1. Create your child swf, including all external info that you want to load into the parent. For simplicity, let's name it "child.swf".

2. Create your parent swf, including all necessary info. Again, let's name it "parent.swf".

{There are numerous ways to solve this problem. I'm gonna present mine - I just find it more flexible and understanable).

{ALL steps bellow are done in the "parent.fla", except mentioned otherwise.)

3. In the parent movie, create an emtpy movie clip (Ctrl-F8), let's name it "loader". Go back to "Scene 1".

4. On the timeline, insert new layer, let's name it "loading layer". That's the layer, in which the "child" will be loaded. So, check what you need to be visible from "parent", and put that layer in the appropriate position.

5. I use button, which triggers the movie to be loaded. So, insert that button with any text you need in the layer and the place you need it.

6. Click on the button and open "Actions" (F9). Insert the following script:

on (release) {
    gotoAndPlay ("loading child");

This script will take you the labeled keyframe "loading child", where the emtpy movie clip is placed and where loading takes place.

7. On the "loading layer" insert a keyframe (F6) at the place, where you want the loading actions to take place. I typically do it at the very end of the "parent" swf, i.e. it would be the last keyframe.

8. Click once on that keyframe on the timeline. In the "Properties" label it "loading child", i.e. just type in those words, where it says "frame label" (bottom left).

9. Insert the emtpy movie clip in that keyframe (just drag from the library). Place it at the position on the screen where you want the "child" to load.

10. Select the movie clip (the one on the screen). In the "Properties", type in the instance name (on the bottom left). Let's say "loading_position".

11. Select the keyframe you're working in (the one labeled "loading child". Open "Actions" (F9). Insert the following script for this frame:

loadMovie("child.swf", "load_position");

The first line loads the movie "child.swf" where the empty movie clip is placed (remember: it's instance name is "load_position"!). The second line stops the "parent" movie on that location - I use it to control the movie flow. Basically, you need it in order to see the "child" movie.

12. That's it. While working in the "parent" movie, test it (Ctrl-Enter) - should be fine.

You may also want to unload the "child" movie after viewing it if it's blocking what you see in the "parent". Simply use the unloadMovie() command in the parent.

Hope you find it useful. And I do hope I made easy to grasp. Shame on me if not - took more than an hour to type that all.

» Level Intermediate

Added: 2003-09-21
Rating: 6.94 Votes: 95
(10 being the highest)
» Author
ehm... still doing my first steps in flash. but already figured out a few bits.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.