Move to X, not Y

I'm currently working on an enemy AI for my platformer game, and I want the enemy to move to the player's X position once the player is in a certain range. Now, I've got the radius thing set up, but struck a problem when making the enemy move to the player's X pos. How do I make the enemy gradually move to the Player's X Position without going to a specific Y Position?
Comments
Using the X position of the player but the enemy's own Y position will do it. :-)
----------------------------------------------------------------------------
iPad app: End of the Earth –•– http://davidgriffinapps.co.uk/
----------------------------------------------------------------------------
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
But the thing is, he'll stop when he reachers the player every time I enter his detection radius, even though I unchecked "Run to completion". Very odd. Also, when he moves down (falls down basically) gravity won't affect it because he's moving down with the same speed as his x-speed when he's moving towards the player (currently at 300)
1. When the Player moves to a certain point and an enemy is within-reach you want the Enemy to move to the Player's X position and then stop?
2. If an enemy is moving (because Player-is-within-reach) but he reaches the end of a platform you want the enemy to fall (not fall with movement to X)? Correct?
In this case but in the enemy to move to the Players x at speed 300 but wrap it in the rule When Player-is-within-reach=1 AND enemy collides/overlaps with Platform. This should stop the move at the edges of the platforms and let gravity take over .. I believe.
Now I'm trying to make the player jump when he reaches an obstacle, which is really hard