Skip to main content
Participant
October 2, 2006
Question

duplicating movielcips

  • October 2, 2006
  • 2 replies
  • 229 views
hello

i've got a situation and i can't really find the solution so i need some help.
i'm trying to duplicate a movieclip and the new movieclip has to have actionscript of its own.
so if there are multiple new movieclips they al have to have their own actionscript.

thx
This topic has been closed for replies.

2 replies

Inspiring
October 2, 2006
Check out the help files for MovieClip.duplicateMovieClip() – make sure that you aren't using the global method (the version that doesn't start with MovieClip) but the method that belongs to the MovieClip class (the one that does)!

First thing, it talks about how when you duplicate a clip the new clip always starts at Frame 1 and that variables (and code) is not copied into the new clip. That means any code you need will have to be added to the new clip.

I would recommend that whenever you read the help files for a given method you check out the "RETURNS" section. Here you will see that this method returns a reference to the newly duplicated clip. So you can use that to help you.

var curClip=myClip.duplicateMovieClip("newClip",1000);
curClip.onRelease=function(){
trace("Clicked "+this);
}

This can be done in a loop or in a lot of other ways depending upon your exact needs.
Participant
October 2, 2006
you could just duplicate the movieclip, and use the "this" feature. It applies it to that specific duplicated movie clip, rather than all of the other clips.

not sure if that helps.