# Changing AS so mouse follow is switched to mouse repel?

**URL:** <https://forum.kirupa.com/t/changing-as-so-mouse-follow-is-switched-to-mouse-repel/214810>\
**Category:** flash\
**Created:** [February 1, 2007, 5:32am UTC](https://forum.kirupa.com/t/changing-as-so-mouse-follow-is-switched-to-mouse-repel/214810 "2007-02-01T05:32:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wagon](https://avatars.discourse-cdn.com/v4/letter/w/e0b2c6/32.png) [@wagon](https://forum.kirupa.com/u/wagon)\
**Post date:** [February 1, 2007, 5:32am UTC](https://forum.kirupa.com/t/changing-as-so-mouse-follow-is-switched-to-mouse-repel/214810/1 "2007-02-01T05:32:43Z")

</div>

So I’m using the .fla attached as a basis for an image scroller (thanks TheCanadian!) and I was just wondering what the process would be to invert it so the “follow” MC is being repelled by the mouse, rather than attracted.

Here’s the code for quick reference…

“follow” is the MC following the mouse and “bounds” is the area in which “follow” can move freely.

```auto
follow.onEnterFrame = function() {
 	this._x += (Math.max(bounds._x + this._width / 2, Math.min(_xmouse, bounds._x + bounds._width - this._width / 2)) - this._x) / 5;
 	this._y += (Math.max(bounds._y + this._height / 2, Math.min(_ymouse, bounds._y + bounds._height - this._height / 2)) - this._y) / 5;
};

```

Thanks!
