Flash: Adjust this code to keep the duplicated movie clip

Posted by Luke Evans on Stack Overflow See other posts from Stack Overflow or by Luke Evans
Published on 2011-01-13T21:49:03Z Indexed on 2011/01/13 21:53 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

OK, so here is my code

ham_mc.onPress=function(){
startDrag(this);
}
ham_mc.onRelease=ham_mc.onReleaseOutside=function(){
stopDrag();
_root.ham_mc.duplicateMovieClip("ham_mc" + "x",2);
x++;
}

The user can at first drag the movie clip. When released, the duplicateMovieClip command runs, leaving a new ham movie clip in the position the first is dragged to.

PROBLEM: When I click and drag the first ham movie click again, the duplicateMovieClip runs again but REPLACES the previous generated movie clip.

I added x and x++ in an attempt to give the movie clip duplication a different name every time, but this doesn't solve it.

How do I change this code so that a NEW ham_mc is created every time, rather than overwriting the old one. I'm tired, sorry for the poor explaination!

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript