# Mouse limit

**URL:** <https://forum.kirupa.com/t/mouse-limit/202673>\
**Category:** flash\
**Created:** [October 3, 2006, 6:35pm UTC](https://forum.kirupa.com/t/mouse-limit/202673 "2006-10-03T18:35:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![max23](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@max23](https://forum.kirupa.com/u/max23)\
**Post date:** [October 3, 2006, 6:35pm UTC](https://forum.kirupa.com/t/mouse-limit/202673/1 "2006-10-03T18:35:05Z")

</div>

Hi , i need limit the mouse of left to right with a mc .

```auto
onClipEvent (enterFrame) {
    if (_parent.mainVar == 0) {
        homeX = (-_parent._xmouse*3)+700;
    } else {
        homeX = (-_parent.mainVar*3)+700;
    }
    thisX = _x;
    diffX = homeX-thisX;
    
    if (_root.mainVar == 0) {
        moveX = diffX/35;
    } else {
        moveX = diffX/5;
    }
    _x = thisX+moveX;
}

```
