# Replicating Drag&Drop mc into "Trashcan"

**URL:** https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552
**Category:** flash
**Created:** [April 29, 2003, 7:29am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552 "2003-04-29T07:29:36Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![1111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/1111/32/206_2.png) [@1111](https://forum.kirupa.com/u/1111)
#### Post date: [April 29, 2003, 7:29am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/1 "2003-04-29T07:29:36Z")

</div>

Hi All, i have an ultimate newbie dumb A33 question…i am trying to replicate a Trashcan (like desktop computer).  
basically, I can duplicate movies no problem on stage, and drag around. I then want to be able to drag any of them into the virtual “trashcan” mc, and unload just that replicated mc, leaving the others.

ie, I duplicate the “box” 4 times. I decide I want only 3, therefore i drag one into the “trashcan”.

Any simple ideas?  
Thanks…:crazy:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 7:59am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/2 "2003-04-29T07:59:21Z")

</div>

simple idea…

```auto
box.onPress = startDrag;
box.onRelease = function() {
	this.hitTest(trashcan) ? this.removeMovieClip() : this.stopDrag();
};

```

😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 8:07am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/3 "2003-04-29T08:07:44Z")

</div>

Yeah, you could use hit test.  
Here’s a quick .fla i did.

Hope this helps.

–EP

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 8:31am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/4 "2003-04-29T08:31:18Z")

</div>

No luck =(

i think my code conflicts.  
i cut it down, but no good.

Maybe i will post the fla?, any chance u could look @ it??

thanks…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 8:32am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/5 "2003-04-29T08:32:35Z")

</div>

yeah… i could do that. 😉 =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 8:33am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/6 "2003-04-29T08:33:13Z")

</div>

el Phantom, thanks, sorry, i didn’t read ur post.  
Thanks for the fla, it is just the code i need to do it.

maybe i will stick to html code instead heh heh.

thanks guys!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 8:34am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/7 "2003-04-29T08:34:53Z")

</div>

Thanks Kax, just finished…

# sends an e-beer =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 8:36am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/8 "2003-04-29T08:36:26Z")

</div>

[size=1]::drinks his e-beer::[/size] 😛 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 9:01am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/9 "2003-04-29T09:01:47Z")

</div>

another Question if i may guys!.

Can you specify that there must always be at least 1 mc on the stage?, as it stands, if you trash the Mc, you cannot regenerate.

maybe confine the original mc to a box?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 9:05am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/10 "2003-04-29T09:05:51Z")

</div>

First of all, use the “startDrag” and “stopDrag” actions, and then use a hitTest action to determine when the dragging MC is over the trashcan. You can use an " if" with the hitTest to determine this, and then “on(release)” to drop the “trash” into the can.  
This “on(release)” would be followed by something like

\_root.trash\_mc.\_visible=false

Is that OK, not very clear, but hope you get the basic idea.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 9:07am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/11 "2003-04-29T09:07:49Z")

</div>

> _Originally posted by .:®:._  
> \*\*another Question if i may guys!.

Can you specify that there must always be at least 1 mc on the stage?, as it stands, if you trash the Mc, you cannot regenerate.

maybe confine the original mc to a box?\*\*

set the \_visible property of the original box to false. 😉

```auto
box._visible = false;

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 9:11am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/12 "2003-04-29T09:11:57Z")

</div>

Thanks a heap guys!..  
=)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 9:12am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/13 "2003-04-29T09:12:25Z")

</div>

I apologise,  
I did not for some stupid reason see the othe reply posts…  
Cheers

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 9:14am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/14 "2003-04-29T09:14:48Z")

</div>

- .:®:.  
welcome. :beam:

- Davehead  
don’t worry… it happens to me all the time. 😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 10:49am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/15 "2003-04-29T10:49:38Z")

</div>

hey kax, what do the ? and : do in your code?! For some reason i’ve never come across it before :-\

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 29, 2003, 5:35pm UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/16 "2003-04-29T17:35:18Z")

</div>

> _Originally posted by blah-de-blah_  
> \*_hey kax, what do the ? and : do in your code?! For some reason i’ve never come across it before :-\*_

just in case you don’t know yet… 😉

[http://www.kirupa.com/developer/actionscript/tricks/tertiary.asp](http://www.kirupa.com/developer/actionscript/tricks/tertiary.asp)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 30, 2003, 8:02am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/17 "2003-04-30T08:02:41Z")

</div>

ah cool i see now thx 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 30, 2003, 8:05am UTC](https://forum.kirupa.com/t/replicating-drag-drop-mc-into-trashcan/19552/18 "2003-04-30T08:05:11Z")

</div>

de nada. 😉 =)
