PDA

View Full Version : How to make objects move on command


cklo0810
12-06-2001, 04:20 AM
I would like to know if anyone can explain to me how to make a
object like a ball to move from left to right by pressing a button.

Any information would be great.

Thanks in advance!

cklo0810@yahoo.com

tg
12-06-2001, 04:41 AM
make a movie clip and give it an instance name of ball
make a button

put both on your main time line.


//on button
on(release){
moveRight=true;
}

//on your movie clip "ball"
onClipEvent(enterFrame){
//if the move right button has been clicked
if(moveRight){
//increment the current _x value by 5
_x+=5;
}
}


of course this will scroll of the right side of your movie so you need to set up some kind of catch like
if _x > moviewidth then _x=0 (or something like that)
or
if _x >= moviewidth then moveLeft (hopefully you get the idea).