Photoshop Tutorials, Flash Tutorials, 3Ds Studio Max Tutorials, Web Design Tutorials


Software Tutorials

Featured Free Templates
View All Templates!
Preview  |  Download
Name: metamorph_flame
Downloads:
Preview  |  Download
Name: metamorph_skyandclouds
Downloads:
View All Templates!
Recommended Hosting:
Host Unlimited Domains on 1 Account
1500GB storage and 15000GB bandwidth for $6.95/mo!
Recommended Hosting:
Host Unlimited Domains on 1 Account
1500GB storage and 15000GB bandwidth for $6.95/mo!
:: Free Website Templates
Preview  |  Download Preview  |  Download Preview  |  Download
Name: metamorph_sunset Name: metamorph_flower Name: metamorph_waterfall
Downloads: Downloads: Downloads:

Do You Like Our Website? Share With Others!
GoogleGoogle slashdotYahooMyWebDiggTechnoratiDelicious
Page: 12345678910111213141516171819202122232425

Welcome To WebDesignTutorials.net Flash Tutorials Area - Load Movies into Levels and Movie clips

The aim of the tutorial is to learn how to use Levels to load several Flash movies (or Jpegs) simultaneously into a single shockwave file (swf). How to switch between one Flash movie and another without loading a new web page. How to load a new movie into a movie clip of a pre-existing movie. To do this we need to look at the following ActionScript keywords:

  • loadMovieNum
  • unloadMovieNum
  • _root
  • _level
  • loadMovie
  • unloadMovie
Example of loading different movies into different levels.

Levels

Levels enable you to play several Flash movies one on top of another or to reload new movies into the same space that the original movie was playing. When you play a Flash movie it automatically plays in level zero. If you want you can simply play one movie over top of the other. Subsequent movies would load into level one, two, three etc.

Start movie file name: KWs-201a__Load-Movie_Start.swf

This is the entire content of the example movie above. All the other content loads from separate movies. The ActionScript in frame 1 automatically loads the next movie:

loadMovieNum("KWs-201b__Load-Movie_1b.swf", 1);

This loads Movie 1B into level 1. The original Start movie continues to play underneath on level 0.

Note: Always include the file extension (.swf) otherwise it will not work. Also all files need to be in the same folder as well as the web page.

Note: There is a small intro tweened animation and the ActionScript in frame 25 is: stop();

Level One Movie

This is the movie that automatically loads into level one. File name: KWs-201b__Load-Movie_1b.swf

Background

Note: The movie above has a gray background, not blue. The background colour of a movie does not load. It always loads with a transparent background. If it was not transparent you could not see the movie underneath, which would be a bit pointless!

Alignment

The size of the movie (in pixels) and length of the Timeline do not matter. No matter what the size of your movie all the movies will align to the top left corner. When you use loadMovieNum you have no control over this but you do have control over the position of objects and symbols within the individual movies.

Note: It is always easier if you make the movies the same document size, this makes it easier to position objects so that they will align.

Reloading a Movie into Level 1

The Home Level 1 button reloads Movie 1b back into level one. The button has the following ActionScript attached:

on (release) {
    loadMovieNum("KWs-201b__Load-Movie_1b.swf", 1);
}
  • The number 1 right at the end of the line sets the level.
  • The KWs-201b__Load-Movie_1b.swf is the file name (including the file extension .swf)  
  • If possible keep your file names short - not like me!!!

Loading a new movie into Level 1

When you click the Next Level 1 button the previous movie 1b is unloaded and movie1c is loaded . The button has the following ActionScript attached:

on (release) {
    loadMovieNum("KWs-201c__Load-Movie_1c.swf", 1);
}

Note: There is no code to unload the previous movie. You cannot have more than one movie in any level so any existing movie is automatically unloaded.

The next movie that loads into Level 1. File name: KWs-201c__Load-Movie_1c.swf

Loading a new movie into Level 2

on (release) {
    loadMovieNum("KWs-201d__Load-Movie_2.swf", 2);
}
The Level 2 Movie. File name: KWs-201d__Load-Movie_2.swf

Unloading the movie from Level 2

This ActionScript clears any movie from the specified level, you do not need to name the movie:

on (release) {
    unloadMovieNum(2);
}

Loading a new movie into Level 0 and clearing all other Levels

This unloads all movies! It does not matter what level they are on. It then loads a new movie into level 0.

on (release) {
    loadMovieNum("KWs-201e__Load-Movie_0.swf", 0);
}
The new Level 0 Movie. File name: KWs-201e__Load-Movie_0.swf

Loading the original Start movie back into Level 0

This places the original Start movie back into level one:

on (release) {
    loadMovieNum("KWs-201a__Load-Movie_Start.swf", 0);
}

Because the Start movie loads Movie1b into level 1 automatically from the ActionScript in the Timeline. The script above:

  •  Unloads level 0 (And all other levels)
  •  Loads the: Start movie into level 0 which in turn ...
  •  Automatically loads: Movie1b into level 1

Jpegs

Although all the movies above are Flash shock wave files (swf) you can use exactly the same code to load Jpeg pictures. The ActionScript would look like this:

loadMovieNum("myImageName.jpg", 1);

The advantage of loading Jpegs is that if you have a site which has many pictures the Flash swf would get very large and take ages to load on the web page. If you use levels the Jpeg loads as they are needed. If you have 200 Jpegs and the viewer only wants to see 3 of them, why wait for 200 to download.

The disadvantage is that they will all align in the top left corner. If you don't want that, place them in an empty Flash movie, locate them in the position you want and load the Flash movie into a level.

Gifs and Pngs cannot be directly loaded into a level. You would need to place them in a Flash movie and load the swf file.

Important Note: When you save your Jpeg make sure the 'progressive' option is not selected as you cannot load progressive Jpegs into Levels.

Controlling different movies: _root Vs _level0

You use one movie to control another. To do this you must be very careful with the use of _root and _level0

What's the difference?

If you only have one movie loaded into level 0 there is no difference at all. For example:

on (release) {
   
_root.myMC.web.gotoAndStop(1);
}
or
on (release) {
   
_level0.myMC.web.gotoAndStop(1);
}

If the movie concerned is loaded into level 0, the above ActionScript will do the same thing.

But if the movie is loaded into level 1 they are quite different:

_root will go to the root directory of the movie in level 1.

_level0 will go to the root directory of the movie in level 0.

In other words:

_root always refers to the root directory of the movie where the command originates from, irrespective of what level it may be on.

_level0 always refers to the root directory of the movie in level 0 irrespective of where the command comes from.

loadMovie

Loadmovie is very similar to loadMovieNum but you guessed it not quite the same. LoadMovie does not load movies into levels but loads one movie inside another movie.

To use loadMovie you place a blank movie clip on the stage of original movie. This movie clip needs an instance name.

The ActionScript syntax is:

loadMovie("nameOfMovie.swf", _root.instanceNameOfBlankMC);

If I placed a blank movie clip on stage with an instance name: blankMC

I could then place the following ActionScript in frame one of my sample movie:

loadMovie("KWs-061__Load-Movie_1b.swf", _root.instanceNameOfBlankMC);

UnloadMovie

The following ActionScript will unload the movie. Note you don't have to name the movie you wish to unload, you only use the instance name of the movie clip.

unloadMovie(_root.instanceNameOfBlankMC);

Action Panel

You will find the loadMovieNum and loadMovie under: Plus > Actions > Browser/Network > loadMovie

In Normal Mode look at the options above the ActionScript and:

For loadMovieNum select: Levels

For loadMovie select: Target

The Actions Panel

The only thing to do now is to go and try to load various Movies and Jpegs. Hopefully you should now find this straight forward. Good luck.

Author: Phil

Advertisements
Graphic Software, Flash Templates, Free Stock Photos, Web Templates, Web Design, Corporate Web Design, Royalty Free stock Photo, Affordable Website Design, Submit site, Add Url, Stock Photos, Survey Software, Anti Virus Software, E mail software, Computer Software

Premium Partners
  Free Website Templates - Flash templates, Affordable Website Design, Website Templates, Website Redesign, Custom Website Design, Web Design Tutorials, Flash Tutorials, Promotion Tutorials - that is what we do. Metamorphosis Design Studio offers quality, free and low cost web site templates for your business and personal life, we also offer affordable web design and site re-design.
  Vertex Website Tempales - It saves tones of time and money to use pre-made web designs to build your web site. You need a web site but you don't want to pay thousands dollars to professional web design companies? Our web templates is just for you! They are designed to be easilly edited by your favorite html editor, like MS FrontPage
  Photoshop Tutorials - Learn how to build stunning web pages using Adobe Photoshop, Macromedia Flash MX and 3D Studio Max software. The step-by-step approach makes it so easy, that even beginners can produce great web pages. Get started with these tutorials covering everything from page layout to content tips.
Free website templates and paid web templates are great tools to make your websites look perfect! You will save time and money with our flash templates and free website templates Our visitors are satisfied with the quality of our free and paid website templates! Please visit our free website templates and paid website templates sections. We offer free web templates, free web layouts, free web page templates and other stuff for free download. All templates come with the html and external css file so you may easily edit HTML with your favorite HTML editor. Feel free to download our free web templates for your personal websites.

Terms of use depend upon the website template vendor.
Home  |  Submit Tutorial  |  Top Sites  |  Free Templates  |  Website Templates  |  Privacy Policy  |  Contact Us
All Right Reserved by WebDesignTutorials.net