• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Objects > Implications for Movie Clips

Implications for Movie Clips

To be perfectly accurate, we’ve already discussed the Movie Clip object. However, by using the techniques that follow, you can effectively drag instances of clips onto the Stage entirely through scripting. You can even draw lines and fills into Movie Clips using script. In the rest of this chapter, you’ll see how to instantiate clip instances at runtime, how to write scripts that get attached to those new clips, and how to draw lines and fills dynamically. Don’t think this is the end of what you can do with Movie Clips, however. You’ll see Movie Clips make appearances in all the following chapters, too.

Instantiating Clips at Runtime

If you want to use scripting to cause a Movie Clip instance to appear on the Stage during runtime, there are two basic methods: duplicateMovieClip() and attachMovie(). The older method (duplicateMovieClip()) requires that you already have a clip on the Stage; when it gets duplicated, everything on it (that is, scripts) is also duplicated. Personally, I always use the attachMovie() method because I don’t have to remember to first place a clip (to be duplicated) on the Stage. However, attachMovie() requires that you first set the linkage for the clip in the Library (as we did for sounds) and come up with a unique identifier. Then, all you do is call the attachMovie() function by using:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint