# X Movement Help

**URL:** <https://forum.kirupa.com/t/x-movement-help/304574>\
**Category:** flash\
**Created:** [February 10, 2010, 8:16am UTC](https://forum.kirupa.com/t/x-movement-help/304574 "2010-02-10T08:16:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kainevg](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@Kainevg](https://forum.kirupa.com/u/Kainevg)\
**Post date:** [February 10, 2010, 8:16am UTC](https://forum.kirupa.com/t/x-movement-help/304574/1 "2010-02-10T08:16:10Z")

</div>

Hey guys,

This is my first post here on the forums (as you can probably tell), but anyway, I am creating my flash game and I have my character, I was originially going to make him move by using the arrow keys which I had set up fine but then I changed my mind and am using the mouse.

I need it so when you click on the stage, it increases the characters X untill he reaches the point. This is what I had come up with:

```auto

 
var CharSpeed:Number = 5
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, MouseXPos);
 
function MouseXPos (e:MouseEvent)
{
 var MouseX = trace(stage.mouseX);
}
 
 if(MouseX < Character.x)
{
Character.x += CharSpeed
}
 

```

I figure this doesnt work because MouseX is inside of the MouseXPos function…

Any help would be great

-Kaine
