Are you talking about top-down movement? Side-scrolling Platform?
Anyway, you can either create an invisible sprite that covers the area that you want the enemy to be alerted with and pin it to the player, or compare the distance between the Player and the Enemy and when it's below a threshold trigger the moving away action.
If you can be more specific it will be easier to help you.