Home > Articles > Graphics & Web Design > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Loading Movies or JPGs

loadMovie is an Action that lets one Flash movie play another. Effectively, the second movie plays on top of the first. It's easier to understand, though, if you think of one movie as the host and the other movie (the one that's loaded on top of the host) as the submovie. Think of a big entertainment system—a wall of stereo and TV equipment. The movie you put into your VCR can only play on the TV screen. If you think of the TV as the host Flash movie, then video you put into your VCR is loaded on top of it.

One reason to do this is because you may have several submovies that only play one at a time. You may want to give the user the choice as to which submovie to play. If you use loadMovie, when the user clicks a button an Action tells Flash to load this movie now. It's sort of like a jukebox, where each record is a separate submovie. The reason loadMovie is beneficial is that only the submovies the user requests have to download.

It's time to look at some of the technical issues with loadMovie; then you can try it out. First, only .swfs can execute the loadMovieAction. Therefore, not only will you have to "Test Movie" to see the results, but the movie (or movies) that are loaded must have already been exported as .swfs. Second, when you use loadMovie, one of the parameters is Location (sometimes called Object), where you specify into which location you want to load the movie. Movies are loaded into one of two basic locations: a clip instance or a level number. If you load a movie into a clip, the clip is replaced with the movie that's loaded. If you load a movie into a level, anything that happens to be in that level currently is replaced by the movie.

Levels are the numbering system Flash uses to describe the stacking order of loaded movies. Your host movie is always in level 0 (referred to as _level0). If you load one movie into _level1 and another into _level2, the _level2 movie will appear on top of everything.

Finally, remember when I said that when you load a movie, it gets loaded "on top"? That's not entirely true. When you load a movie into a clip, the loaded movie is in the same level as the clip. That is, if the clip was in front of something or behind something, the loaded movie will be, too. In the case of loading a movie into a level, the loaded movie will be in front of everything else that happens to be assigned lower-level numbers and behind items assigned higher-level numbers. The _root Stage is always _level0. Therefore, if you load a movie into _level1, it will be on top. However, if you load another movie into _level2, it will be on top of everything—the first loaded movie (_level1)will be sandwiched between the Stage and the new loaded movie.

  • + Share This
  • 🔖 Save To Your Account