
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
342
|
Chapter 13: Movie Clips
The Programmatically Generated Content Stack
Programmatically generated instances are normally stacked separately from the man-
ually created instances held in the internal layer stack. Each movie clip has its own
programmatically generated content stack that holds:
• Movie clip instances created via duplicateMovieClip(), attachMovie(), and
createEmptyMovieClip()
• Text field instances created via createTextField()
The stacking order for movie clips in the programmatically generated content stack
varies, depending on how they were created.
How clips generated via attachMovie() and createEmptyMovieClip()
are added to the stack
A new instance generated via attachMovie() or createEmptyMovieClip() is always
stacked above (i.e., in the foreground relative to) the clip to which it was attached.
For example, suppose that we have two clips—
X and Y—in the internal layer stack of
a movie and that
X resides on a layer above Y. Now further suppose we attach a new
clip,
A, to X and a new clip, B, to Y:
x.attachMovie("A", "A", 0);
y.attachMovie("B", "B", 0);
In our scenario, the clips appear from top to bottom in this order: A, X, B, Y, as shown
in Figure 13-1.
Once a clip is generated, it too provides a separate space above its internal layer stack
for more programmatically