Written by: Metrov / fineartwebdesign.com
Time: Less than an hour
Difficulty Level: Beginner
Requirements: Flash 5 and above[Will also work in F4, but the scripts and commands may differ slightly.]
Assumed Knowledge: Understanding of basic Flash procedures

When I began making All Flash Websites that loaded menu movies into different levels, I noticed that sometimes, not always, but sometimes there was a delay when clicking a menu button. Even with preloaders, this delay sometimes occurs. I knew this occasional delay [probably caused by network congestion] might cost me a visitor, perhaps even a client if he/she sat there thinking, "What's wrong with this site? I click the buttons and nothing happens!" Well, if they waited long enough, something would happen. The menu movie would appear sooner or later, but I couldn't depend on anyone waiting around, nor would I expect them to. So, I conceived the 'Initializing Movie', a small MC that would appear instantly regardless of any delay. That way, the viewer would always know that SOMETHING was happening. It's not an original concept by any means, there are countless variations, I'm sure. But here's a simple way to do it.

NOTE: The delay in this sample has been simulated.

Download the source.

1) First of all, create the Background [Main] movie. This will be the foundation, and all the other movies will be loaded into layers on top of this one. The background color you chose for this movie will determine the background color of all the other movies, as Loaded Movies always take on the background color of the main movie. Of course, you can put whatever you want in this movie, your logo, or other images, but for now just add some text.

2) Next, create a 2nd layer, then Right Click the first keyframe. Open the Actions panel from the drop down menu. In the Action editor, click on Basic Actions. Then Double Click on LoadMovie. Where it says URL, type in "Interface.swf" without the quotes. For Level, type in a "3". Your code should look like this:

loadMovieNum ("Interface.swf", 3);

You are asking Flash to Load the Interface Movie [which we will create next] onto Level 3 which will be the topmost level of our project.

3) Now, create a new .fla with the same dimensions as the first one, and save it as 'Interface'. We are creating and loading it separately into its own level, so that it will sit on top of the loaded menu movies. That way, the interface will always be available to the user. First of all, create a Panel graphic that covers the top third of the movie area. You can type INTERFACE on it if you like, and make it a different color than the Background movie so that it stands apart.

4) Next create a new layer and name it 'actions'. Right Click the first keyframe of the layer, and open the Actions panel. Click on Basic Actions, then Double Click Load Movie. Where it says URL, type in "InitializingMovie.swf" without the quotes. For Level, type in a "2". Your code should look like this:

loadMovieNum ("InitializingMovie.swf", 2);

You are asking Flash to Load the Initializing Movie [which we will create shortly] onto Level 2.

5) Next create a simple button. In this case, we've made only one button that says 'ONE'. When you make your actual Interface, you will have several menu buttons, of course. Position the button on the Interface Panel.

6) Right Click on the button to open the Action editor. Create the following code, beginning by Double Clicking 'On Mouse Event' in Basic Actions:

on (release) {
        tellTarget ("_level2"){
                gotoAndPlay (2);
on (release) {
        loadMovieNum ("MovieOne.swf", 1);

Here we are placing an action that says, when the user clicks the button, whatever movie is in level2, [the Initializing Movie] should go and Play frame 2. As you will see in a moment, the first frame of the Initializing Movie will be blank. So by telling it to go to frame 2, which is where the content resides, we will be making it visible. Remember, it will already have been loaded by the Interface Movie. [Step 4].

Furthermore, that same click will Load Movie One into level 1.

7) Now we shall create the Initializing Movie. Start a third .fla with the same dimensions as the others, and save it as 'InitializingMovie' [no spaces]. Create three layers, with two keyframes each.

Two layers are for your graphical elements. In the bottom layer, leave the first keyframe blank, then create a simple panel in the 2nd keyframe. In the middle layer, again, leave the first keyframe blank, then in the 2nd keyframe, create the text, 'INITIALIZING' which you can animate if you like. In the top layer, put a 'Stop' action in each keyframe.

8) Next start a new .fla, same dimensions as the others, and create your menu or content movie; save as 'MovieOne'. Of course the real thing will contain tons of fabulous animation and data for the delight of your viewers, but for this exercise, just put in some graphics and text, so you can see it when it arrives.

9) The important thing is the action that will tell the Initializing movie to go away. In its own layer, create the following code in the first keyframe:

tellTarget ("_level2") {
        gotoAndPlay (1);

When Movie One shows up, the above code will be triggered, telling the Initializing Movie [the only resident in level 2] to return to frame 1. Since frame 1 is blank, the Initializing Movie becomes invisible. [NOTE: In the sample .fla, there is an extra preliminary scene in Movie One. This scene is only there to simulate network delay, and is not necessary for your real life Initializing Movie. If there is no delay in real life, then the Initializing Movie will be instructed to vanish as soon as the menu movie comes up which might be real quick. But as long as the menu movie doesn't come up, your good old Initializing Movie will let your visitor know that SOMETHING is happening.]

10) Now publish your .swfs and test your work. If it doesn't work, make sure the spelling of all your .flas and action scripts is EXACT. If you have even one misspelling, or space that shouldn't be there, the thing just won't work. Also make sure you've published everything in the same folder or directory. Always check and double-check and test, test, test.

11) Don't forget, your Initializing Movie can do almost anything you like -- blink, dance, spin, it can even be draggable! Just don't make it too big, because it must load almost instantly.

email Metrov