The Hidden Power of Flash Components
|
|
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 |
|
Setting Up the Load Action
Now let's load the movie into the Action parameter:
-
Delete the Video layer, which should delete the green rectangle.
-
Select the instance of the Drop Down Menu component and open the Component Parameters panel.
-
Click the Next Page button to go to the second page.
-
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).
Figure 5.20: Selecting Item 2 in the Menu Items parameter and Item 3 in the Sub Item For Main Item#2 parameter -
Click the Edit Click Action button.
-
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 -
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).
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.
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.
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.
|
|