Drag and drop

I built a button bar and i want to make that bar draggable and droppable. in another words i want to drag that bar from the bottom to the left or left to the right of bottom to the righ and so on just like windows “start” bar. i know how to make that bar draggable but i have no clue how to make that bat droppable.

Also i don’t want for users to drop the bar anywhere, only in certain areas left side right side top or bottom.

any help will b every appreciated

Thanks
:cowboy:

To stop dragging use

on (release){
stopDrag();
}

Now for just dragging it left and right you can use (if MC in MX)

on (press) {
this.startDrag(true, Left, Top, Right, Bottom);
}

It drags the clip, sets the lockCenter to true, the the Left is how far left you want it to go, Top is how far up you want it to go (top and bottom should be equal here so you can only drag it left and right), Right is how far right it can go and bottom is how far down it can go.

if useing startDrag (especially with bounds) I suggest using

on (release, releaseOutside){
stopDrag();
}

so the dragging will stop whenever the mouse is released and not just wen its released while over the clip. Since startDrag is frame dependant its easy to move your mouse fast and not be below the clip which if done on a release will not stop the dragging since release is only called when the mouse is touching the clip… and of course the mouse wouldnt be there also if the clip is constrained and against a boundry while the mouse is out of range

Oh, I did forget that. Good catch Sen. Thanks.