Search code examples
flashactionscript-2macromedia

how to duplicate MC in macromedia flash 8


I'm having problems to duplicate movie clips in AS2. Can someone help me to get the general idea how I do this?


Solution

  • First of all, the IDE: Right click on a symbol in the library and select 'Duplicate'.

    Now, code:

    var duplicate:MovieClip = original.duplicateMovieClip("duplicateClip",this.getNextHighestDepth());
    

    What you're doing here is calling the duplicateMovieClip function of your existing clip, telling it a name and depth for your new clip. It returns a reference to the new clip, which is stored in the duplicate variable.