Replicating Drag&Drop mc into "Trashcan"

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:

simple idea…

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

:stuck_out_tongue:

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

Hope this helps.

–EP

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…

yeah… i could do that. :wink: =)

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!

Thanks Kax, just finished…

sends an e-beer =)

[size=1]::drinks his e-beer::[/size] :stuck_out_tongue: :wink:

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?

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.

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. :wink:

box._visible = false;

Thanks a heap guys!..
=)

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

  • .:®:.
    welcome. :beam:

  • Davehead
    don’t worry… it happens to me all the time. :stuck_out_tongue:

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

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… :wink:

http://www.kirupa.com/developer/actionscript/tricks/tertiary.asp

ah cool i see now thx :slight_smile:

de nada. :wink: =)