Flash Lite 1.x ActionScript Language Reference |
|
|
|
| Flash Lite Global Functions > duplicateMovieClip() | |||
Flash Lite 1.0.
duplicateMovieClip(target,newname,depth)
target The target path of the movie clip to duplicate.
newname A unique identifier for the duplicated movie clip.
depth A unique depth level for the duplicated movie clip. The depth level indicates a stacking order for duplicated movie clips. This stacking order is much like the stacking order of layers in the timeline; movie clips with a lower depth level are hidden under clips that have a higher depth level. You must assign to each duplicated movie clip a unique depth level so that it does not overwrite existing movie clips on occupied depth levels.
Function; creates an instance of a movie clip while the SWF file plays. Returns nothing. The playhead in a duplicate movie clip always starts at Frame 1, regardless of where the playhead is in the original (parent) movie clip. Variables in the parent movie clip are not copied into the duplicate movie clip. If the parent movie clip is deleted, the duplicate movie clip is also deleted. Use the removeMovieClip() function or method to delete a movie clip instance created with duplicateMovieClip(). Reference the new movie clip by using the string passed in as the newname operand.
The following example duplicates a movie clip named originalClip to create a new clip named newClip, at a depth level of 10. The new clip's x position is set to 100 pixels.
duplicateMovieClip("originalClip", "newClip", 10);
setProperty("newClip", _x, 100);
The following example uses duplicateMovieClip() in a for loop to create several new movie clips at once. An index variable keeps track of the highest occupied stacking depth. Each duplicate movie clip's name contains a numeric suffix that corresponds to its stacking depth (clip1, clip2, clip3).
for (i = 1; i <= 3; i++) {
newName = "clip" add i;
duplicateMovieClip("originalClip", newName); }
|
|
|
|