# Why won't this follow my cursor

**URL:** <https://forum.kirupa.com/t/why-wont-this-follow-my-cursor/309369>\
**Category:** flash\
**Created:** [May 13, 2010, 4:17am UTC](https://forum.kirupa.com/t/why-wont-this-follow-my-cursor/309369 "2010-05-13T04:17:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Seanooo](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Seanooo](https://forum.kirupa.com/u/Seanooo)\
**Post date:** [May 13, 2010, 4:17am UTC](https://forum.kirupa.com/t/why-wont-this-follow-my-cursor/309369/1 "2010-05-13T04:17:54Z")

</div>

Hello everybody, just joined and I hope someone can help me.

I don’t know if I have this right but I want the ‘cat\_mc’ to ‘flip’ to face the cursor if the cursor is on the left side of the ‘cat\_mc’ and flip back if it’s on the right side once the cursor has passed over. If that makes sense. Thanks for taking the time to read my question.

ps. this part of the code fires when you ROLLOVER buttons.

function followCat(event:Event):void {

```
stage.addEventListener(Event.ENTER_FRAME,followCat);
var where_mouse = mouseX;
var dx:int=cat_mc.x-mouseX;
cat_mc.x-=dx/5;

if(mouseX &gt; where_mouse) {scaleX = -1;
} else if
	(mouseX &lt; where_mouse) {scaleX = 1;
}

}
```
