Loading a Movie

The ability to load a movie into another movie is particularly valuable if you are working with Flash movies that have high bandwidth content such as bitmap imagery, videos, or audio.

Let's say that you have five videos, each 500 KB. If you import them into your main movie, they would total at least 2.5 MB—which is usually far too much of a download. However, if you use Load Movie to load each movie, the main movie will load much faster, and the other movies will only load if the viewer clicks to view them. If the viewer decides to view only one movie, they need only wait for 500 KB of content to load versus waiting for 2.5 MB of content to load.

Setting the drop-down menu to load a movie is easy enough. The trouble is setting up that movie to behave the way you want it to. In particular, you need to set your movies to load in the positions that you want them. Let's look at an example.

Setting Up the Movies

One of the submenu items in the example instance of the Drop Down Menu component in the take2.fla file is labeled New York. In this next exercise, you will set that button to load a movie that contains a video of New York City.

The video's dimensions are 320 pixels wide by 240 pixels high. The stage size of the take2.fla file is 800 pixels wide by 600 pixels high. So, the first thing we need to do is determine where we want the video to be located on the stage. Follow these steps:

On the CD 
  1. Start by adding a layer to the main Timeline of the take2.fla file. Find the top layer on the Timeline named Banner and add a new layer above that. Name the new layer "Video" (see Figure 5.16).


    Figure 5.16: Add a new layer above the Banner layer named Video.

  2. Now draw a rectangle that is 320 pixels wide by 240 pixels high on the stage.

  3. Delete the outline and fill the rectangle with a bright green color so that it is easy to see.

  4. Press Command/Ctrl+I to open the Info panel. Make sure the small black registration point is in the upper left and then enter 235 for the X position and 333 for the Y position. As you can see in Figure 5.17, this places the green rectangle over the bottom two-thirds of the area in the take2.fla file where the main text is displayed.

    click to expand
    Figure 5.17: Creating a place for your video

  5. Now you need to create a movie with the video positioned in that same spot. Open the file named newyork.fla in the Chapter 5 directory on the CD.

  6. Press Command/Ctrl+J to open the Document Properties dialog box.

  7. Notice that the stage size for the newyork.fla Flash file is 320 pixels wide by 240 pixels high. Change the dimensions of newyork.fla to match the dimensions of the take2.fla file by entering 800 for the Width and 600 for the Height (see Figure 5.18).


    Figure 5.18: Changing the dimensions of the newyork.fla file

  8. Click OK to close the Document Properties dialog box.

  9. If the Info panel is not open, press Command/ Ctrl+I to open the Info panel.

  10. Make sure the small black registration point is in the upper left and then enter 235 for the X position and 333 for the Y position (see Figure 5.19). Now you have positioned the video in the same place that you positioned the green rectangle back in the take2.fla file.

    click to expand
    Figure 5.19: Positioning the video at 235 X and 333 Y using the Info panel.

  11. Save the movie to your local hard drive. Be sure to save the movie in the same directory that you saved the take2.fla file.

  12. Publish the movie, close the movie, and then return to the take2.fla movie.

Setting Up the Load Action

Now let's load the movie into the Action parameter:

  1. Delete the Video layer, which should delete the green rectangle.

  2. Select the instance of the Drop Down Menu component and open the Component Parameters panel.

  3. Click the Next Page button to go to the second page.

  4. Select Item 2 in the Menu Items parameter and then select Item 3 in the Sub Item For Main Item #2 parameter. The label in the Menu Items parameter should be Instructors, and the label in the Sub Item For Main Item #2 parameter should be New York (see Figure 5.20).

    click to expand
    Figure 5.20: Selecting Item 2 in the Menu Items parameter and Item 3 in the Sub Item For Main Item#2 parameter

  5. Click the Edit Click Action button.

  6. Set the Action parameter to Load Movie and enter newyork.swf in the URL To Load parameter, as shown in Figure 5.21.


    Figure 5.21: Loading a movie in the Action parameter

  7. Click the Close button; then close the Components Parameters panel.

Now you can publish the movie. Roll over the Instructors main heading and then click the New York submenu button. The newyork.swf file is loaded into the take2 movie in the correct position (see Figure 5.22).

click to expand
Figure 5.22: The newyork.swf movie loads into the proper position.

The newyork.swf movie loads into a predictable position because you set the newyork.fla file's stage size to the same size as the take2.fla stage size. Then you positioned the movie in the newyork.fla file in the same position that you wanted it to appear in the take2.fla file. When newyork.swf is loaded into take2.swf, the Flash player ignores the background and only displays the visible contents of the newyork.swf file, which is the video.

The Load Movie action works very well, and it's easy enough to implement. However, there are a few problems. First, notice that when you clicked the New York submenu option, the text associated with the submenu didn't appear. The only thing that happened was that the video loaded. So one problem with using the Load Movie option is that there is no support for navigating around the Flash movie and loading the movie at the same time.

You will notice another problem if you click any of the other submenu options when you're viewing the take2 movie. The problem is that the newyork.swf movie won't go away. Once you load the movie, it always stays visible until you unload the movie. Unfortunately, there's no"unload movie" option in the Drop Down Menu component's parameters.

start sidebar

In the second page of the custom UI for the Drop Down Menu component is a parameter called Load Movie Level. The default value for this parameter is 10. If you change the value to 0, then you would replace the take2 movie with the newyork movie. Level 0 is the level that the host or main movie is on. Therefore, you need to set the Load Movie Level value to anything other than 0.

end sidebar

You could load another movie to replace the newyork.swf movie. So, for example, you could set every other submenu button to load a movie, and each time a new movie loads, it will replace the previously loaded movie. If you don't want another video to load when the viewer clicks a different submenu option, you could load a movie that has absolutely no visible contents.

These issues with the Load Movie option boil down to the fact that you'll probably want to use Load Movie only if you plan to use Load Movie with all of your button options. If you need to load a movie and perform one or more additional actions at the same time, you'll need to use the Advanced Script option. We will look at that option in a moment. First let's look at the Simple Script option.




The Hidden Power of Flash Components
The Hidden Power of Flash Components
ISBN: 0782142109
EAN: 2147483647
Year: 2002
Pages: 111

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net