HELP with AS moving an object and stopping

i’m trying to move an object on the main timeline after a button has been released. I have found the following script to make the object move by itself with no button:

onClipEvent(enterFrame) {
	speed = 1;
	_root.clip_mc._x += speed;

but i would like that object to move based on the events of a button, then stop at a certain point. then if another button is pressed, move again to another point and stop.

how can i modify this to help me out?