# AS3 Trouble moving mc in relation to the mouseX

**URL:** https://forum.kirupa.com/t/as3-trouble-moving-mc-in-relation-to-the-mousex/301473
**Category:** flash
**Created:** [December 9, 2009, 7:50pm UTC](https://forum.kirupa.com/t/as3-trouble-moving-mc-in-relation-to-the-mousex/301473 "2009-12-09T19:50:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wuzzi2ya](https://avatars.discourse-cdn.com/v4/letter/w/e79b87/32.png) [@wuzzi2ya](https://forum.kirupa.com/u/wuzzi2ya)
#### Post date: [December 9, 2009, 7:50pm UTC](https://forum.kirupa.com/t/as3-trouble-moving-mc-in-relation-to-the-mousex/301473/1 "2009-12-09T19:50:59Z")

</div>

Issue: Im am trying to animate a movieClip in relation to the mouseX (cursor). If I move my mouse to the left, I would like the movieClip.x to move in the opposite direction as well as movieClip.z and rotationY. Please review my code and push me in the right direction. I feel as though I am getting very close.

```auto
this.addEventListener (Event.ENTER_FRAME,beginRotation);
function beginRotation (e:Event):void {
    event3.rotationY = -stage.mouseX;
    event3.x = stage.width-stage.mouseX;
    event3.z = stage.width-stage.mouseX;
    trace ("movin");
}

```

Please any help is great!

Thanks!
