ActionScript Bouncing Ball
To create a ball that bounces around the edges of the window you need to use the enterFrame event. You will need to create a movie clip on the stage in exactly the same way as the ActionScript follow mouse example. Remove the code that is present in the movie clip object and put this code in its place.
onClipEvent(load){
speedX = 5;
speedY = 5;
}
onClipEvent(enterFrame){
this._x += speedX;
this._y += speedY;
if(this._x >= 550){
speedX = -speedX;
}else if(this._x <= 0){
speedX = -speedX;
}
if(this._y >= 400){
speedY = -speedY;
}else if(this._y <= 0){
speedY = -speedY;
}
}
The first part of the script sets up two variables (speedY and speedX) when the flash program loads. The rest of the script keeps the ball from going outside the confines of the frame.
Information, services, and products:We have a great choice of Window Stickers come and see.
Thats’it?? Where is the rest? WHY would you think this would be helpful for ANYONE?
Hey give em a break its for basic learners so hush yo mouth up
@daZe
what do you mean? he explains the rest in the link he linked to I think.
did you mean more explanation on how it works?
it checks if its past aboundry, and if it is, negates the speed so it bounces.
it also moves with the speed rate.