EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Adding Parameters to Dynamically Created Movie Clips

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
128 Chapter 7: Working with Movie Clips
To attach a movie clip to another movie clip:
1 Assign a linkage identifier to a movie clip library symbol, as described above.
2 With the Actions panel open (Window > Development Panels > Actions), select a frame in
the Timeline.
3 In the Actions panel’s Script pane, type the name of the movie clip or level to which you want
to attach the new movie clip. For example, to attach the movie clip to the root Timeline,
type
_root.
4 In the Actions toolbox (at the left of the Actions panel), click the Built-in Classes category, the
Movie category, and the MovieClip category, and double-click attachMovie().
5 Using the code hints that appear as a guide, enter values for the following parameters:
For idName, specify the identifier you entered in the Linkage Properties dialog box.
For newName, enter an instance name for the attached clip so that you will be able to
target it.
For depth, enter the level at which the duplicate movie clip will be attached to the movie
clip. Each attached movie clip has its own stacking order, with level 0 as the level of the
originating movie clip. Attached movie clips are always on top of the original movie clip.
Here is an example:
myMovieClip.attachMovie("calif", "california", 10);
For more information, see MovieClip.attachMovie() on page 488.
Adding parameters to dynamically created movie clips
When you create or duplicate a movie clip dynamically using MovieClip.attachMovie() and
MovieClip.duplicateMovie(), you can populate the movie clip with parameters from another
object. The
initObject parameter of attachMovie() and duplicateMovie() allows
dynamically created movie clips to receive clip parameters. The
initObject parameter
is optional.
For more information, see
MovieClip.attachMovie() on page 488 and
MovieClip.duplicateMovieClip() on page 498.
To populate a dynamically created movie clip with parameters from a specified object, do
one of the following:
Use the following syntax with attachMovie():
myMovieClip.attachMovie(idName, newName, depth [, initObject])
Use the following syntax with duplicateMovie():
myMovieClip.duplicateMovie(idName, newName, depth [, initObject])
The initObject parameter specifies the name of the object whose parameters you want to use to
populate the dynamically created movie clip.

Table of Contents

Related product manuals