Basic AI - Side scrolling game

Hey I’m having a bit of trouble with getting the AI to work with my side scrolling game i have an enemy and a player char that you can control, on the enemy i have:

onClipEvent (load) {
speed = 5;
}
onClipEvent (enterFrame) {
if (this._x > _root.player._x+speed) {
this._x-=speed;
} else if (this._x < _root.player._x-speed) {
this._x+=speed;
}
}

but when move right so the image scrolls it doesnt seem to follow the player anymore.

if anyone can help me add me on msn, i can send u my fla if need be
MSN: sachmojo277@hotmail.com