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

**URL:** <https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190720>\
**Category:** Uncategorized\
**Created:** [June 14, 2006, 5:39am UTC](https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190720 "2006-06-14T05:39:36Z")\
**Posts on this page:** 2\
**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, 5:39am UTC](https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190720/1 "2006-06-14T05:39:36Z")

</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]\_global.newone = item.duplicateMovieClip(“myClip” + numberOfClips + “\_mc”, numberOfClips);[/COLOR]

[COLOR=navy]newone.startDrag();[/COLOR]  
[COLOR=navy]newone.\_alpha = 60;[/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]newone.onPress = function() {[/COLOR]  
[COLOR=navy]\_root.current\_item = this;[/COLOR]  
[COLOR=navy]this.startDrag();[/COLOR]  
[COLOR=navy]}[/COLOR]

[COLOR=navy]newone.onRelease = function() {[/COLOR]  
[COLOR=navy]this.stopDrag();[/COLOR]  
[COLOR=navy]}[/COLOR]

[COLOR=navy]numberOfClips++;[/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…☹

---

<div class="post-metadata">

**Author:** ![Kajico](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@Kajico](https://forum.kirupa.com/u/Kajico)\
**Post date:** [October 25, 2006, 6:23pm UTC](https://forum.kirupa.com/t/how-to-duplicate-click-and-dragged-objects-help-needed/190720/2 "2006-10-25T18:23:02Z")

</div>

hi, I was wondering if anybody could help me on expanding on this. This works fantastically but I was wondering if there is a way to get it so that each new object made is draggable as well?
