# Easing mc on drag/drop

**URL:** <https://forum.kirupa.com/t/easing-mc-on-drag-drop/293430>\
**Category:** Uncategorized\
**Created:** [July 28, 2009, 8:55pm UTC](https://forum.kirupa.com/t/easing-mc-on-drag-drop/293430 "2009-07-28T20:55:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hausnfranz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hausnfranz/32/2427_2.png) [@Hausnfranz](https://forum.kirupa.com/u/Hausnfranz)\
**Post date:** [July 28, 2009, 8:55pm UTC](https://forum.kirupa.com/t/easing-mc-on-drag-drop/293430/1 "2009-07-28T20:55:50Z")

</div>

I am using this code to ease a drag/drop motion. The only problem is that the mc eases y=0 to where ever the mouse currently is when pressed. How can I have the mc just start moving from where it was before, without jumping to the mouse position?

```auto

stop();

var easing:Number = 0.3;
//var targetX:Number = null;
var targetY:Number = null;// Function to create mouse movement function on pressing of the box
mc_box.onPress = function() {
    mc_box.onMouseMove = function() {// update target values
        //targetX = _root._xmouse;
        targetY = _root._ymouse;
    };
};// Function to delete mouse function on release of box
mc_box.onRelease = mc_box.onReleaseOutside=function () {
    delete mc_box.onMouseMove;
};// Enterframe to update movement of box
mc_box.onEnterFrame = function() {// update incrementation values     
    //incX = (targetX-mc_box._x)*easing;
    incY = (targetY-mc_box._y)*easing;// increment box X value if not equal to targetX     
    //if (mc_box._x != targetX) {
        //mc_box._x += incX;
    //}
    // increment box Y value if not equal to targetY      
    if (mc_box._y != targetY) {
        mc_box._y += incY;
    }
};

```
