# Drag button between 2 scrollpanes

**URL:** <https://forum.kirupa.com/t/drag-button-between-2-scrollpanes/36844>\
**Category:** Uncategorized\
**Created:** [December 2, 2003, 3:11pm UTC](https://forum.kirupa.com/t/drag-button-between-2-scrollpanes/36844 "2003-12-02T15:11:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![foshizo](https://avatars.discourse-cdn.com/v4/letter/f/f19dbf/32.png) [@foshizo](https://forum.kirupa.com/u/foshizo)\
**Post date:** [December 2, 2003, 3:11pm UTC](https://forum.kirupa.com/t/drag-button-between-2-scrollpanes/36844/1 "2003-12-02T15:11:52Z")

</div>

I’m having a helluva time trying to figure out how to drag & drop a button from one scrollpane to another.

sPane1 // contains target’s  
sPane2 // contains button’s

//button code  
on (press) {  
\_root.attachMovie(“theWord”, “tempWord1”, 99);  
\_root[“tempWord1”].\_x=\_root.\_xmouse-(this.\_width/2);  
\_root[“tempWord1”].\_y=\_root.\_ymouse-(this.\_height/2);  
startDrag(\_root[“tempWord1”]);  
}

onClipEvent (mouseUp) {  
var dropzone1:String=sPane1;//.spContentHolder[“WordPatch1”];  
// see if the dropZone conatins the center of this mc  
if (\_root.dropZone1.hitTest(this)) {  
// center it on the drop zone  
this.\_x = \_root.dropZone1.\_x;  
this.\_y = \_root.dropZone1.\_y;  
trace(“YES”)  
} else {  
// return it to its original location  
trace(“NOPE”)  
this.\_x = origX;  
this.\_y = origY;  
}  
this.stopDrag();  
}

yes i know i need more but i dont know how to do it, can someone show me how.

thank you. 🍺
