• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Exporting a Movie

Every time you choose Control > Test Movie command, Flash creates a .swf file in the same directory as the .fla file. So if you were to look in your MyWork folder, you'd see several .swf files there, each of which was created when you tested a movie. This procedure is just one way to create a .swf file. Another way to create this type of file, as well as several other formats, is to export your movie by using the Export Movie command. You can use this command to give the .swf file a name other than of the name of the .fla file. That's what you'll do in this exercise. You'll also learn how to add content to an existing movie.

Select frame 30 of the Background Graphic layer in the Content scene of neptune37.fla, and choose Insert > Clear Keyframe. Do the same for frame 35 of the Background Graphic layer.

If you do not have a copy of neptune37.fla in the MyWork folder, you can find a copy in the Lesson12/Assets folder. Just open that file and save it in the MyWork folder before you continue.

These two frames have content loaded into them, complete with a unique background graphic, so they don't need to have a background in this movie. By removing the contents of these two frames, you make the movie even smaller. You can test the movie to see how much the file size has decreased. Just remember that you have a new scene with a stop action at the beginning of the movie, so you'll see a black screen if you test the movie.

Open map9.fla in the MyWork folder. Choose File > Export Movie. When the Export Movie dialog box opens, choose Flash Player (*.swf) from the Save As Type drop-down menu, browse to the MyWork folder, type map.swf in the File Name text box, and click Save.

If you can't find map9.fla in the MyWork folder, you can find a copy of it in the Lesson12/Assets folder. You don't have to save the .fla file to the MyWork folder; just export the .swf file.

When you export the movie as a Flash Player movie, all the interactivity and sound in the movie are preserved. Notice that you can save the movie as several file types, including QuickTime, Animated GIF, and JPEG sequence. These file types might not preserve the interactivity and sound of your movie.

Before the movie is exported, the Export Flash Player dialog box opens. You can leave all these settings at their defaults and click OK. You'll look at some of the export options later in this lesson.

Repeat step 2 for merfolk4.fla, music.fla, jigsaw3fla, and journal6.fla. Export these movies as merfolk.swf, music.swf, jigsaw.swf, and journal.swf, respectively.

If you don't find the correct .fla files in the MyWork folder, you can find copies of them in the Lesson12/Assets folder. The music.fla file contains the music toggle that was removed from the movie because it contains a linked sound. Linked sounds must be loaded completely during the beginning of a movie, before any actions occur. This toggle would make your preloader inoperable until the sound has been loaded.

When you export any movies that contain bitmaps (GIF, JPEG, and PNG files, for example), you should specify a JPEG Quality setting in the Export Flash Player dialog box. The default setting is 50, which produces a relatively small file with low-quality bitmaps. If you'd like to increase the quality of the bitmaps, increase the JPEG Quality setting to, say, 80. You can also specify lossless compression in the Bitmap Properties dialog box. To open this dialog box, double-click the icon to the left of a bitmap in the library.

Select frame 25 of the Actions Labels layer in neptune37.fla. Add the ActionScript loadMovieNum ("map.swf", 1);.

The loadMovieNum action has two arguments: URL and level. The URL argument contains the URL of the .swf file that you want to load. The level is much like a layer. Levels have a stacking order. The movie that Flash Player loads (the movie you're working with) is in level 0. In this case, you are loading map.swf into level 1, so it will be above the current movie in the level stacking order.

Now you need to load the rest of the .swf files that you exported in the appropriate frames.

Select frame 30 of the Actions/Labels layer. Add the following ActionScript:

myMovies = new Array(); 
myMovies[0] = "jigsaw.swf";
myMovies[1] = "merfolk.swf";
moviePick = random(myMovies.length);
loadMovieNum (myMovies[moviePick], 1);

The ActionScript you just added first creates a new array containing the names of the .swf files that you want to load into this frame. Then it sets the value of a variable named moviePick to a random number based on the length of the array. Because the array has a length of 2, the value of moviePick is either 0 or 1. Finally, the loadMovieNum action loads a movie from the myMovies array, based on the moviePick variable, into level 1.


An array is a list of variables. Each line of the list can contain a single variable, the value of which can be anything from a string to a number or an object or even another array. After you have created an array, you reference a line of the array by giving the name of your instance and then the line number inside square brackets like this: myArray [2]. The line number is called the index. It always starts at 0.

Add some ActionScript to frame 35 of the Actions/Labels layer to load journal.swf into level 1. Add some more ActionScript to frame 1 of the Actions/Labels layer to load music.swf into level 10.

This ActionScript will be similar to the ActionScript that you added to frame 25. You just use a different URL argument for each frame. The URL argument for frame 35 will be journal.swf, and music.swf will be the argument for the ActionScript in frame 1. The loadMovieNum action in frame 1 also requires a new level argument, as follows, to reflect that you want to load the movie into level 10:

loadMovieNum ("music.swf", 10); 

You can load a movie into any level, whether or not movies are loaded into all the levels below it.

Add the ActionScript unloadMovieNum (1); to frames 15, 20, and 40 of the Actions/Labels layer:

You should add this ActionScript to the top of the Actions list so that it occurs before the rest of the actions in each frame. This ActionScript unloads the movie in level 1, if a movie is already loaded there. This situation is important, because some of the frames contain content that is not loaded. Because the levels have a stacking order, and because you're loading content into level 1 in other frames, frames that don't have loaded content will have their contents hidden by the level-1 movies.

If a movie is already loaded into a level, and a loadMovieNum action attempts to load a movie into that level, the old movie is replaced by the new one. So you don't need to add any unloadMovieNum actions to the frames that load a new movie into level 1.

Choose Control > Test Movie, and test the movie.

As you view each section of the movie, you should see the appropriate content when you click one of the buttons in the navigation bar. Some of the content is loaded, and some of it is part of the neptune37.fla movie.

Close the test movie, and save the movie as neptune38.fla.

You're almost done. After you complete one more exercise, your project will be ready for the Web.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint