For more information, see
Reference.
Duplicating or removing a movie clip
To duplicate or remove movie clip instances, use the
removeMovieClip()
duplicateMovieClip()
it a new instance name, and gives it a depth, or z-order. A duplicated movie clip always starts at
Frame 1, even if the original movie clip was on another frame when duplicated and is always in
front of all previously defined movie clips placed on the Timeline.
To delete a movie clip you created with
Duplicated movie clips are also removed if the parent movie clip is deleted.
For more information, see
ActionScript Language Reference.
Attaching a movie clip symbol to the Stage
The last way to create movie clip instances at runtime is to use
attachMovie()
the Stage. The new clip becomes a child clip of the clip that attached it.
To use ActionScript to attach a movie clip symbol from the library, you must export the symbol
for ActionScript and assign it a unique linkage identifier. To do this, you use the Linkage
Properties dialog box.
By default, all movie clips that are exported for use with ActionScript load before the first frame
of the SWF file that contains them. This can create a delay before the first frame plays. When you
assign a linkage identifier to an element, you can also specify whether this content should be
added before the first frame. If it isn't added in the first frame, you must include an instance of it
in some other frame of the SWF file; if you don't, the element will not be exported to the
SWF file.
To assign a linkage identifier to movie clip:
Select Window > Library to open the Library panel.
1.
Select a movie clip in the Library panel.
2.
In the Library panel, select Linkage from the Library panel options menu.
3.
The Linkage Properties dialog box appears.
For Linkage, select Export for ActionScript.
4.
For Identifier, enter an ID for the movie clip.
5.
By default, the identifier is the same as the symbol name.
You can optionally assign an ActionScript 2.0 class to the movie clip symbol. This lets the movie
6.
clip inherit the methods and properties of a specified class. (See
clip symbol" on page
212
Chapter 8: Working with Movie Clips
MovieClip.createEmptyMovieClip()
global functions, or the MovieClip class methods of the same name. The
method creates a new instance of an existing movie clip instance, assigns
duplicateMovieClip()
method attaches an instance of a movie clip symbol in the SWF file's library to
218.)
duplicateMovieClip()
duplicateMovieClip()
and
removeMovieClip()
in Flash ActionScript Language
or
, use
removeMovieClip()
in Flash
. The
attachMovie()
"Assigning a class to a movie
.
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers