# Following mouse and stop following mouse

**URL:** <https://forum.kirupa.com/t/following-mouse-and-stop-following-mouse/197610>\
**Category:** Uncategorized\
**Created:** [August 17, 2006, 6:09pm UTC](https://forum.kirupa.com/t/following-mouse-and-stop-following-mouse/197610 "2006-08-17T18:09:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ceejeeb](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@Ceejeeb](https://forum.kirupa.com/u/Ceejeeb)\
**Post date:** [August 17, 2006, 6:09pm UTC](https://forum.kirupa.com/t/following-mouse-and-stop-following-mouse/197610/1 "2006-08-17T18:09:57Z")

</div>

i have a movieclip that when pressed the following code executes:

```auto

function startDragging(mc1:MovieClip) {
    onEnterFrame = function () {
        mc1._x = _root._xmouse;
        mc1._y = _root._ymouse;
    };
}

jiggy1_1.onPress = function() {
    this.swapDepths(0);
    startDragging(jiggy1_1);
};

```

this enables it to follow the mouse but how do i then stop it following the mouse when the mouse is clicked again?
