[as1 Flash8] Movement

I have a black square in the middle of the stage named “m”.
This black square moves right and left, up and down, with a changeable speed, like, increasing speed ->acceleration, and decreasing speed -> deceleration.
The problem is:

How to do this movieclip goes easying when it reachs the right limit -50 (by the Flash coordenates, right more x, left less x), or the left limit + 50?
I mean, for example:

Imagine if you have a stage size with the properties 800x600, so you have 800 of width.
If the movieclip (“m”), goes right and it passes the 750 x point, the movieclip should go easying (decreasing) the speed gradually untill speed reachs 0, and the movieclip reachs on the edge of the stage. That is, the 800 x point, minus the movieclip width divided by 2 if the movieclip named “m” are with the registration point exactly in its middle, or just its width if you are using Flash 8 or higher.
Remember, the movieclip should return to middle and do the exactly same movement when going the right or left limits again.

Thanks :slight_smile: