Home » Articles » FLASH TUTORIALS » ActionScript 2 (AS2)

Bouncing Ball

HOW TO CREATE A BOUNCING BALL  FLASH AS2.

Hallow funs! Here is the simplest method to design and coding the bouncing ball using Flash Actionscipt 2. After this tutorial you”ll have a realistic bouncing ball. But I recommend that you learn few articles about Flash Program in order to have basic knowledge of this Program just by clicking Here.

If you have basic knowledge ready let’s go along as here under:

Step 1: Open Adobe Flash which supports AS2.

Step2: Design a ball using Oval Tool found in Tool menu. (press Ctrl +F2 to view or hide tools).

Step 3: Change properties of your ball for your own preference.

Step 4: Select the whole ball  shape and convert it  to symbol by simply pressing F8 key. The dialogue box will appear.

Step 5: From Dialogue box, change the name of the symbol into the name you prefer to, and change registration to be Down, a registration point is the default location of an object from which an object's x and y co-ordinates are determined. Then press OK. See the picture below:

Click to View/Hide Image
" />

Step 6: Give the name of your MovieClip (MC) form the properties menu. . (press Ctrl +F3 to view or hide properties). See the picture below:

Click to View/Hide Image
" />

Now you have the instance of the ball on your stage.

Step 6: Add some simple codes to your instance in order to make it live as follows:

  1. Select frame 1 from the Timeline (press Ctrl + Alt + T to view or hide Timeline).
  2. Open Action script window by going to WINDOW >> ACTIONS  (Shortcut  Press F9).
  3. Now the window will appear, then type the following codes. (remember, I am going to give out codes in divisions so as to make you understand)

Division 1.

gravity = 5
onEnterFrame = function(){
ball._y+= gravity
}

By putting only the above code, the ball will fall but will neither stop nor bounce, test your movie to see just by pressing ENTER Key on your Keyboard.

END OF PART ONE

Click here for the Second part.

Category: ActionScript 2 (AS2) | Added by: Admin (29/May/2016)
Views: 623 | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *: