Movie clips are at the very core of ActionScript. Without movie clips there would be no visual element to a Flash movie, so you can see why they are incredibly important.
Unlike many other object types, movie clips are never instantiated using a constructor function (the MovieClip class constructor is used only when creating subclasses, as in Recipe 12.12). Instead, movie clips are created in one of four ways:
Manually (at authoring time)
Attached from the Library at
Duplicated from another
movie clip at runtime, using
Created as a new, empty
Once a movie clip has been instantiated, it can be controlled in a
variety of ways. The timelines of movie clips can
playback methods such as
stop( ), and
). Movie clips can be assigned actions that occur when
certain events are triggered, and movie
clip attributes can be controlled such
that you can affect position, rotation, transparency, and so on.
To control a movie clip using ActionScript, you must know the target path to that instance. Each movie clip in a movie can be targeted in one of two ways: using a relative path or an absolute path. In relative paths there is a known relationship between the timeline from which the instructions are being issued and the movie clip to which they are being addressed. For example, a movie clip can address itself ...