PDA

View Full Version : gravity ball



pawel
May 8th, 2002, 02:01 PM
Hello,
How can I move (on click) the ball up?
I'd like to click in ball and move it up, the gravity move it down as well...
Pawel

Aaron Burgess
May 8th, 2002, 11:04 PM
Make a button shaped like a ball.

Then place that button into a empty movie clip, and in the buttons action script type this

on (press) {
grab = true;
startDrag ("");
}
on (release) {
grab = false;
stopDrag ();
}

Place the movie (with the button in it) onto the stage, and type this into it's script

onClipEvent (enterFrame) {
if (grab == false && _y < 250) {
_y += 10;
}
}

Then you can move the ball up, and when you drop it, it'll fall back down. Just change _y < 250 to the distance that suits you.