# duplicateMovieClip - loop Help Please!

**URL:** <https://forum.kirupa.com/t/duplicatemovieclip-loop-help-please/261721>\
**Category:** flash\
**Created:** [May 30, 2008, 7:41am UTC](https://forum.kirupa.com/t/duplicatemovieclip-loop-help-please/261721 "2008-05-30T07:41:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![preetid](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@preetid](https://forum.kirupa.com/u/preetid)\
**Post date:** [May 30, 2008, 7:41am UTC](https://forum.kirupa.com/t/duplicatemovieclip-loop-help-please/261721/1 "2008-05-30T07:41:41Z")

</div>

Hi,  
I’m trying to make a dress up game and have run into problems with duplicateMovieClip. I would like the user to drag and drop items of clothing from within a movieclip onto the stage, and when the movieclip is closed, that item of clothing should be still there. As the movieclip is small, the item will be small in size initially which will become bigger after it’s dropped on the stage. Each time the movieclip is opened, the user will be able to drag a new duplicate. This is the code I’ve written on the button ‘top’ inside movieclip ‘clothes’:

on (press) {  
top.startDrag();  
for (i=1; i\<3; i++) {  
duplicateMovieClip(“top”, “top”+i, this.getNextHighestDepth());  
temp\_mc = this[“top”+i];  
}  
temp\_mc.\_width = 90;  
temp\_mc.\_height = 90;  
temp\_mc.onPress = function() {  
startDrag(“temp\_mc”);  
};  
temp\_mc.onRelease = function() {  
stopDrag();  
};  
}

2 problems with this code, the original ‘top’ does not disappear once the movieclip ‘clothes’ is closed, and the next time I open the movieclip, it doesn’t duplicate. What am I doing wrong?  
I’d appreciate _any_ help on this, flash file attached,  
Thanks!

---

<div class="post-metadata">

**Author:** ![jon\_bla](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jon\_bla](https://forum.kirupa.com/u/jon_bla)\
**Post date:** [May 30, 2008, 12:56pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-loop-help-please/261721/2 "2008-05-30T12:56:11Z")

</div>

```auto

var tmp:MovieClip = _root.createEmptyMovieClip("source_mc", 1);
for(var i = 0;i<10;i++){
       var tmpClip:MovieClip = tmp.duplicateMovieClip("duplicate_" + i, _root.getNextHighestDepth(), {_x:tmp._x + (i + 1) * 5});
    trace(tmpClip._x);
}

```

provided by user Valaran
