This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Macromedia Flash > November 2003 > Dragging buttons





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Dragging buttons
lolarocks webforumsuser@macromedia.com

2003-11-30, 12:41 pm

I want to be able to drag an object and drop it in another place, and I remember learning several years ago how to do this with an invisible button, but haven't ever had to use it in real life and am now totally stumped. (I'm working in Flash 5.)

Can anybody refresh my pea brain on this??


Platypus

2003-11-30, 12:41 pm

something.startDrag()
something.stopDrag()


urami_

2003-11-30, 12:41 pm

quote:

> I want to be able to drag an object and drop it in another place, and I remember learning several years ago how to do this with an invisible button, but haven't ever had to use it in real life and am now totally stumped. (I'm working in Flash 5.)
>
> Can anybody refresh my pea brain on this??



the basic way :
place button inside movie clip, than give each button the following action

on (press) {
startDrag(this);
}
on (release) {
stopDrag();
}


You can as well define one function , apply to multiple movie clip w/o using buttons
at all :

On timeline frame place the following function :

function DragDudeON (movie) {
if (movie.hitTest(_root._xmouse, _root._ymouse, false)) {
movie.startDrag();
movie.swapDepths(++_root.top);
}
}
function DragDudeOFF (movie) {
stopDrag ();
}


Than on every draggable movie clip the following action :

onClipEvent (mouseDown) {
_root.DragDudeON(this);
}
onClipEvent (mouseUp) {
_root.DragDudeOFF(this);
}

NOTE !
there is no buttons here , only movie clips .


the Swap Depth as well helps here as draggable items will follow the order of depth
in which you create them in the first place , would make them be drag under another.
Swap Depth bring the one you drag at the moment to front .







Regards

urami_*



<lsym>

There's no place like 127.0.0.1

</lsym>
Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews