Need help slowing/stopping movement at two set extremes

Using Flash 8 - AS2

I am proud of myself for getting this far, but I cannot figure the rest :doh:

I have a movie clip that moves from side to side based on the position of the mouse. If the mouse is right of center, the movie clip moves left, the speed based on the distance of the pointer to the center. Conversely, the same for the other direction.

Here’s the AS on the clip event:


onClipEvent(load){
	speed=10;
}
onClipEvent(enterFrame){
	this._x += (_root.center-_root._xmouse)/speed;

}

(the speed variable is just a simple method to slow down my motion.)

Now what I need it to do and can’t figure out out is this:
> How to get it to have upper and lower limits of motion.
> How to get it to slow down and stop at the upper and lower limits
> How to get it to stop at the limit until the mouse triggers movement back in the other direction

I ended up here because of the bouncing tutorial, and for awhile there I thought I was onto the solution, but I cannot get it retrofitted to work with my mouse position stuff.

thanks!