PDA

View Full Version : Replicating Drag&Drop mc into "Trashcan"



.:®:.
April 29th, 2003, 03:29 AM
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:

kode
April 29th, 2003, 03:59 AM
simple idea...

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

El Phantom
April 29th, 2003, 04:07 AM
Yeah, you could use hit test.
Here's a quick .fla i did.

Hope this helps.

--EP

.:®:.
April 29th, 2003, 04:31 AM
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....

kode
April 29th, 2003, 04:32 AM
yeah... i could do that. ;) =)

.:®:.
April 29th, 2003, 04:33 AM
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!

.:®:.
April 29th, 2003, 04:34 AM
Thanks Kax, just finished...

# sends an e-beer =)

kode
April 29th, 2003, 04:36 AM
::drinks his e-beer:: :P ;)

.:®:.
April 29th, 2003, 05:01 AM
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?

Davehead
April 29th, 2003, 05:05 AM
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.

kode
April 29th, 2003, 05:07 AM
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. ;)

box._visible = false;

.:®:.
April 29th, 2003, 05:11 AM
Thanks a heap guys!........
=)

Davehead
April 29th, 2003, 05:12 AM
I apologise,
I did not for some stupid reason see the othe reply posts....
Cheers

kode
April 29th, 2003, 05:14 AM
- .:®:.
welcome. :beam:

- Davehead
don't worry... it happens to me all the time. :P

blah-de-blah
April 29th, 2003, 06:49 AM
hey kax, what do the ? and : do in your code?! For some reason i've never come across it before :-\

kode
April 29th, 2003, 01:35 PM
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

blah-de-blah
April 30th, 2003, 04:02 AM
ah cool i see now thx :)

kode
April 30th, 2003, 04:05 AM
de nada. ;) =)