Move the ball


can somebody help me, Im working on a school project and Im stuck.
the idea is to have this ball moves after you click on a button, then it will stop moving after it has moved 25 pixels to the right, and when you click on that button again, it will move again, and will stop until it has moved 25 pixels.

I’m still far from that goal… I’m having a problem with stoping the ball from looping.

here’s what I got:

a_btn.onRelease=function () {
onEnterFrame=function () {
ball._x +=12;
if (box._x >= hr._x ){

hr is the bar so that when the ball hits hr it will stop… I know this is not the way to stop the ball after moving 25 pixels… I just don’t know how to do it.

i know this should be simple lines of code… but this is too much for me.

I need to make it work, moving 25 pixels then stop, hit the button again… the ball will move 25 pixels then stop… and so on

then I have to make it backward… but I guess if I know how to make it move forward, backward shouldn’t be that hard?

any help would be really appreciated.