Share this Page URL

Lesson 7. Programming with ActionScript > Attaching a Movie Clip to the Movie - Pg. 143

Programming with ActionScript 143 6. When you drag the tack around, it should appear as it did before. When you drop it, the instance named tackTip disappears, because its _visible property has been set to false. Also, the entire tack moves down 11 pixels, so the tack appears to be pushed into the map when you stop dragging it. Close the test movie, and save the movie as map5.fla in the MyWork folder. You still have work to do with this movie, so keep it open for the following exercise. Attaching a Movie Clip to the Movie You can retrieve a copy of a movie clip from a library and play it as part of your movie by using the attachMovie method. The attached movie clip does not have to be on the stage or in the work area, but it does have to be exported with the movie. The way you retrieve the clip and play it is by modifying the linkage properties of the movie clip in the Library window. After you use the attachMovie method to attach a movie clip to the movie, you can use the clip just as you would any other clip, so you can refer to and modify its properties dynamically. You can also remove an attached movie clip by using the removeMovieClip method, which you will learn about later in this lesson. In this exercise, you will use the attachMovie method to add the tack directly from the library instead of placing it on the stage. You should still have map5.fla open from the preceding exercise. 1. In the map5.fla library, right-click (Windows) or Control-click (Macintosh) the Tack Clip movie clip. From the contextual menu, choose Linkage. The Symbol Linkage Properties dialog box opens. You worked with this dialog box in Lesson