# How to duplicate click and dragged objects? Help Needed!

**URL:** <https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190711>\
**Category:** flash\
**Created:** [June 14, 2006, 2:47am UTC](https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190711 "2006-06-14T02:47:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![suriaz20](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@suriaz20](https://forum.kirupa.com/u/suriaz20)\
**Post date:** [June 14, 2006, 2:47am UTC](https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190711/1 "2006-06-14T02:47:14Z")

</div>

Hi,

I’m supposed to create something like this:

1. Create 4 coat of arms (Shields)
2. Pour colour onto different segments of the shields
3. Click and drag objects onto the shield
4. Print

**My problems lies in step 3.**

How do I actually **[COLOR=darkred]create multiple copies of the same object that I clicked and dragged[/COLOR]**? At the same time, I also want the original copy to stay in position so I will only need to click and drag on the original copy to create the duplicates.

I got the code from the net (I’m no pro in this). What I did was, convert the object into a button, then into a movie clip. Double-clicked the movie clip, I inserted the following code on the **movie clip** :

[COLOR=navy]on(press) {[/COLOR]  
[COLOR=navy]duplicate(this)[/COLOR]  
[COLOR=navy]}[/COLOR]

**Then on the movie clip’s frame, I inserted this:**

[COLOR=navy]function duplicate(item) {[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]\_global.newone = item.duplicateMovieClip(“myClip” + numberOfClips + “\_mc”, numberOfClips);[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]newone.startDrag();[/COLOR]  
[COLOR=navy]newone.\_alpha = 60;[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]newone.onMouseUp = function() {[/COLOR]  
[COLOR=navy]newone.\_alpha = 100;[/COLOR]  
[COLOR=navy]this.stopDrag();[/COLOR]  
[COLOR=navy]this.onMouseUp = null;[/COLOR]  
[COLOR=navy]}[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]newone.onPress = function() {[/COLOR]  
[COLOR=navy]\_root.current\_item = this;[/COLOR]  
[COLOR=navy]this.startDrag();[/COLOR]  
[COLOR=navy]}[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]newone.onRelease = function() {[/COLOR]  
[COLOR=navy]this.stopDrag();[/COLOR]  
[COLOR=navy]}[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]numberOfClips++;[/COLOR]  
[COLOR=navy][/COLOR]  
[COLOR=navy]}[/COLOR]

This works BUT when I tried to click and drag other objects, the **previous object dragged onto the shield goes missing**. Some objects though, stayed. The end product is a bit messy.

btw, I don’t really understand the above code. Is there any way to modify the code or create any other new code for this to work?

Help me…please…☹
