![MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual Download Page 121](http://html1.mh-extra.com/html/macromedia/flash-mx-2004-actionscript/flash-mx-2004-actionscript_reference-manual_3378897121.webp)
121
CHAPTER 7
Working with Movie Clips
Movie clips are self-contained miniature SWF files that run independently of each other and the
Timeline that contains them. For example, if the main Timeline has only one frame and a movie
clip in that frame has ten frames, each frame in the movie clip plays when you play the main SWF
file. A movie clip can, in turn, contain other movie clips, or
nested
clips
. Movie clips nested in this
way have a hierarchical relationship, where the
parent
clip
contain one or more
child
clips
.
Every movie clip instance has a name, called its
instance name
, that uniquely identifies it as an
object that can be controlled with ActionScript. Specifically, the instance name identifies it as an
object of the MovieClip class type. You use the properties and methods of the MovieClip class to
control the appearance and behavior of movie clips at runtime.
You can think of movie clips as autonomous objects that can respond to events, send messages to
other movie clip objects, maintain their state, and manage their child clips. In this way, movie
clips provide the foundation of
component-based architecture
in Macromedia Flash MX 2004 and
Macromedia Flash MX Professional 2004. In fact, the components available in the Components
panel (Window > Development Panels > Components) are sophisticated movie clips that have
been designed and programmed to look and behave in certain ways. For information on creating
components, see
Using Components
.
About controlling movie clips with ActionScript
You can use global ActionScript functions or the methods of the MovieClip class to perform tasks
on movie clips. Some MovieClip methods perform the same tasks as functions of the same name;
other MovieClip methods, such as
hitTest()
and
swapDepths()
, don’t have corresponding
function names.
The following example illustrates the difference between using a method and using a function.
Both statements duplicate the instance
my_mc
, name the new clip
newClip
, and place it at a depth
of 5.
my_mc.duplicateMovieClip("newClip", 5);
duplicateMovieClip("my_mc", "newClip", 5);
When a function and a method offer similar behaviors, you can choose to control movie clips by
using either one. The choice depends on your preference and familiarity with writing scripts in
ActionScript. Whether you use a function or a method, the target Timeline must be loaded in
Flash Player when the function or method is called.
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...