# Buttons repositioning draggable mc

**URL:** <https://forum.kirupa.com/t/buttons-repositioning-draggable-mc/314852>\
**Category:** Uncategorized\
**Created:** [October 11, 2010, 6:04am UTC](https://forum.kirupa.com/t/buttons-repositioning-draggable-mc/314852 "2010-10-11T06:04:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ceesay](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@ceesay](https://forum.kirupa.com/u/ceesay)\
**Post date:** [October 11, 2010, 6:04am UTC](https://forum.kirupa.com/t/buttons-repositioning-draggable-mc/314852/1 "2010-10-11T06:04:34Z")

</div>

I have an mc that is repositioned with this code:  
onClipEvent (enterFrame) {  
Ysquare = this.\_y;  
Ydiff = Ypos-Ysquare;  
Ymove = Ydiff/3;  
this.\_y = Ysquare+Ymove;  
updateAfterEvent(enterFrame);  
}  
onClipEvent (enterFrame) {  
Xsquare = this.\_x;  
Xdiff = Xpos-Xsquare;  
Xmove = Xdiff/3;  
this.\_x = Xsquare+Xmove;  
updateAfterEvent(enterFrame);  
}

Buttons reposition via x-y coordinates. However, this mc needs to be draggable.

I can code the drag and onClipEvent repositioning to work separately, but can’t seem to have them work together.
