Working with Movie Clips > Using actions and methods to control Timelines > Attaching movie clips

Attaching movie clips

You can retrieve a copy of a movie clip from a library and play it as part of your movie using the attachMovie method. This method loads another movie clip into your movie clip and plays it as the movie runs.

To use the attachMovie method, the movie clip being attached must be given a unique name in the Symbol Linkage Properties dialog box.

To name a movie clip for sharing:

1 Select the movie clip in the movie's Library that you want to attach.
2 In the Library window, choose Linkage from the Options menu.
3 For Linkage, choose Export This Symbol.
4 In the Symbol Linkage Properties dialog box, for Identifier, enter a name for the movie clip. The name must differ from the symbol's name in the library.
5 Click OK.

To attach a movie clip to another movie clip:

1 In the Actions panel, specify the target to which you want to attach a movie clip.
2 In the Toolbox list, select the MovieClip object and then select the attachMovie method.
3 Set the following arguments:
For idName, specify the Identifier name that you entered in the Symbol Linkage Properties dialog box.
For newName, enter an instance name for the attached clip so that you will be able to target it.
For depth, enter the level at which the duplicate movie will be attached to the movie clip. Each attached movie has its own stacking order, with level 0 as the level of the originating movie. Attached movie clips are always on top of the original movie clip.
For example:
myMovieClip.attachMovie("calif", "california", 10 );