Load Movie | 1 2 | continued:

3:

Repeat the first step, but don't create a movie clip. FlashMX has a new feature that lets you create an empty movie clip with a simple line of action script.

 

Apply the following script to your load button:


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

 

Notice the "createEmptyMovieClip"!

 

The line tells flash to create an empty movie clip on the main timeline (_root) of the main flash, call it area and place it on level1.

 

That's it :)

 

Tip: If you have more than 1 button and you'd like to load other files as well without unloading the current one, use different levels, 2,3,4.. and so on.

 

Note: Make sure all your flash files are in the same directory/folder.


Conclusion:

What we did:

  • Created 2 buttons, a movie clip and added an Instance Name to it.
  • Applied an action to one of the buttons to load the external file and used the target movie clip on the main swf file to reposition the loaded one.
  • Added the "unloadMovie" action to the other button.
  • FlashMX users can use the "createEmptyMovieClip" to skip the "creating a movie clip" step, as the script can do that.

Advantages and usability of LoadMovie Action:

 

You can use this action to load different sections of your flash site on demand. Meaning, if your site consists of 4 buttons, seperate the content of each button and place it into its own file, add a preloader to each file, and you're done.

 

In doing this, you can easily manage your files later on for updates.
Also, you can save download time, as the user loads whatever he wants whenever he wants, not everything at once in the beginning.

 

Hope you enjoyed the tutorial and found it beneficial :)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Download *.FLA

Not clear enough? Check our forums. We will be glad to help you out.
   
Main | Tutorials | BestFlash | Goodies | Forums | Portfolio | Contact Us
   
 
AEvision Tutorials 2.1 - All rights reserved AEvision Designs 2002-2007
 
 
Icons provided by iconpacks.com