# I'm so close on this....just need one tweek

**URL:** <https://forum.kirupa.com/t/im-so-close-on-this-just-need-one-tweek/234129>\
**Category:** Uncategorized\
**Created:** [July 30, 2007, 7:35pm UTC](https://forum.kirupa.com/t/im-so-close-on-this-just-need-one-tweek/234129 "2007-07-30T19:35:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtrace](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dtrace](https://forum.kirupa.com/u/dtrace)\
**Post date:** [July 30, 2007, 7:35pm UTC](https://forum.kirupa.com/t/im-so-close-on-this-just-need-one-tweek/234129/1 "2007-07-30T19:35:53Z")

</div>

I’m using the following code to have an MC follow the users mouse based on it’s x value. But I’d like to have this inverted…so that if the users mouse goes right, the MC goes left…instead of going right along with the mouse. You know? How could I do this? I feel it is just one tweek away.

```auto

 
 
import mx.utils.Delegate;
class Mover {
 
 private var target:MovieClip;
 private var limits:MovieClip;
 private var ease:Number;
 
 private var leftX:Number;
 private var rightX:Number;
 private var topY:Number;
 private var bottomY:Number;
 
 
 /*
  * Constructor
  *
  * @param target defines the movieclip to move
  * @param limits movieclip used at the limits or bounds for target's movements
  *
  * @param ease Number that provides the easing on the movieclip. Higher num = ease.
  */
 public function Mover(target:MovieClip, limits:MovieClip, ease:Number)
 {
  this.target = target;
  this.limits = limits;
  this.ease = (ease != undefined) ? ease : 22;
  
  leftX = limits._x;
  rightX = limits._x + limits._width;
  
 }
 
 
 /*
  * Method that starts the animation
  */
 public function start():Void
 {
  target.onEnterFrame = Delegate.create(this, onEnterFrame);
  function onEnterFrame():Void
  {
   var x:Number = Math.min(Math.max(_xmouse, leftX), rightX);
   var y:Number = Math.min(Math.max(_ymouse, topY), bottomY);
   
   target._x += (x - target._x) / ease;
   target._y += (y - target._y) / ease;
  }
 }
 
}
 

```
