Creating Interactive Movies > Using basic actions for navigation and interaction > Loading and unloading additional movies
Loading and unloading additional moviesTo play additional movies without closing the Flash Player, or to switch movies without loading another HTML document, use the Load Movie action.
The Unload Movie action removes a movie previously loaded by the Load Movie action.
These are some sample uses of the
Load Movie action:
![]() |
Playing a sequence of banner ads that are SWF files, by placing a Load Movie action at the end of each SWF file to load the next movie. |
![]() |
Developing a branching interface that lets the user choose among several different SWF files. |
![]() |
Building a navigation interface with navigation controls in level 0 that load other levels. Loading levels produces smoother transitions than loading new HTML pages in a browser. |
To load a movie:
1 | Select the frame, button instance, or movie clip instance to which you will assign the action. |
2 | Choose Window > Actions to display the Actions panel. |
3 | In the Toolbox list, click the Basic Actions category to display the basic actions, and select the Load Movie action. |
4 | In the Parameters pane, for URL specify an absolute or relative URL for the SWF file to load. |
For use in the Flash Player or for testing in Flash, all the SWF files must be stored in the same folder and listed as file names without folder or disk drive specifications. | |
5 | For Location, choose either Level or Target from the pop-up menu. |
6 | If you choose Level for Location, enter a level number as follows: |
![]() |
To load the new movie in addition to existing movies, enter a level number that is not occupied by another movie. (To keep the movie and update the variables with new values, use the Load Variables action; for more information, see ActionScript Help.) |
![]() |
To replace an existing movie with the loaded movie, enter a level number that is currently occupied by another movie. |
![]() |
To replace the original movie and unload every level, load a new movie into level 0. |
The movie loaded first is loaded at the bottom level. The movie in level 0 sets the frame rate, background color, and frame size for all other loaded movies. Movies may then be stacked in levels above the movie in level 0. | |
For more information on levels and targets, see the movie clips chapter of ActionScript Help. | |
7 | If you choose Target for Location, specify a movie clip that will be replaced by a loaded movie. |
The loaded movie inherits the position, rotation, and scale properties (attributes) of the targeted movie clip. The loaded movie's upper left corner is placed at the registration point of the target movie clip (the cross hairs location in symbol-editing mode). | |
8 | For Variable, choose a method for sending variables for the loaded movie to the location listed in the URL text box: |
![]() |
Choose Send Using Get to append a small number of variables to the end of the URL. For example, you would use this option to send the values of the variables in a Flash movie to a server-side script. |
![]() |
Choose Send Using Post to send variables separate from the URL, as longer strings in a separate header. This method lets you send more variables and lets you post information collected from a form to a CGI script on the server. For example, you can send variables to a CGI script, which generates a SWF file as its CGI output. |
![]() |
Choose Don't Send to not pass any variables. |
See the Web applications chapter of ActionScript Help. | |
In the following example, clicking a button loads a movie into the root directory at level 0, replacing any existing movie, and sends variables to the loaded movie using the Get method: | |
loadMovie ("someFile.cgi", 0, "GET"); |
|
where "someFile.cgi" outputs a Flash movie in SWF file format. |
|
![]() |
To unload a movie from a Flash movie window:
1 | Select the frame, button instance, or movie clip instance to which you will assign the action. |
2 | Choose Window > Actions to display the Actions panel. |
3 | In the Toolbox list, click the Basic Actions category to display the basic actions, and select the Unload Movie action. |
4 | For Location, choose one of the following options from the pop-up menu: |
![]() |
For a loaded movie, select Level and enter the level of the movie that you want to unload. |
![]() |
To target a movie to unload, select Target and enter the path of the movie that you'll target to unload. To enter an expression that evaluates to a level or movie, select Expression and enter the expression. For example: |
unloadMovie (3); |
|
targets the movie on level 3 and unloads it. | |
![]() |
To test a Load Movie or Unload Movie action:
1 | If you're testing a Load Movie action, make sure that the movie being loaded is at the specified path. If the path is an absolute URL, an active network connection is required. |
2 | Choose Control > Test Movie. |
![]() |
Note: The Load Movie and Unload Movie actions do not work in editing mode.