Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

ACTIVITY MOVING BALL

GROUP # ______________________ DATE: ____________

1. Create a movie clip named ball


2. Type the following scripts for ball movie clip action panel
onClipEvent (load) {
var dir:Number = 0;
Button
}

onClipEvent (EnterFrame) {
if (dir == 0) {
this._x +=5;
if (this._x > 650) {
dir = 1;
}
} else if (dir ==1) {
this._x -=5;
if (this._x < 100) {
dir = 0;
}
}
}

3. Create a button
4. In the button action panel type the following scripts:
on(press){
if (ball2.dir == 1){
ball2.dir = 0;
} else if (ball2.dir ==0) {
ball2.dir=1;
}
}

5. Save it as movingball.fla and test your program.

Members Name:
_________________________
_________________________
_________________________
_________________________
_________________________

You might also like