# Movie controlled by mouse position

**URL:** <https://forum.kirupa.com/t/movie-controlled-by-mouse-position/227975>\
**Category:** Uncategorized\
**Created:** [June 4, 2007, 11:24am UTC](https://forum.kirupa.com/t/movie-controlled-by-mouse-position/227975 "2007-06-04T11:24:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakka](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yakka](https://forum.kirupa.com/u/yakka)\
**Post date:** [June 4, 2007, 11:24am UTC](https://forum.kirupa.com/t/movie-controlled-by-mouse-position/227975/1 "2007-06-04T11:24:45Z")

</div>

Hi guys

I is trying to get my movie to move in the opposite direction to the mouse within a certain area, eg when my movie gets to the edge of the area it slows down.

I’ve got this far but now I is stuck…

```auto
onClipEvent (enterFrame) {
    _root.yChange = Math.round(_root._ymouse+this._y);
    _root.xChange = Math.round(_root._xmouse+this._x);
    _root.yMove = Math.round(_root.yChange/20);
    _root.xMove = Math.round(_root.xChange/20);
    this._y -= _root.yMove;
    this._x -= _root.xMove;
}

```

Any pointers would be grand

cheers guys
