Flash tutorials
Home 3D (2) Actionscripting (65) Animation (100) Audio (4) Drawing (7) Full flash sites (4) Getting Started (15) Navigation (25) Special Effects (52) Text Effects (38)

Object control

24.11.2006, 0:11    Total views: 28621

Learn this tutorial and see how to control any object, using a buttons and Action Script in flash 8 .



Step 1

Create a new flash document and set Width to 200, and height to 300px. After that, frame rate set to 16fps.





Step 2


Double click on layer1 to rename its name in background. Then, insert a new layer and name it button1.

Step 3

Take the Text Tool (T), set font, size and color which you like, and type somewhere on the top of  stage "Come here". See the picture below.



Step 4

While your "text" is still selected, press F8 key (Convert to Symbol), to convert it into a Button.



Step 5

Then, select the button, open the Action Script Panel (F9), and paste this scritp:

on (rollOver) {
tellTarget ("/object") {
gotoAndPlay(12);
}
}

Step 6

Insert a new layer and name it button2. Then, take the Text Tool (A), and type somewhere on the bottom of stage "Come here" again.



Step 7

While your "text" is still selected, press F8 key to convert it into a Button, like we have done for the first text.

Step 8

After that, select the button, open the Action Script Panel (F9), and paste this script:

on (rollOver) {
tellTarget ("/object") {
gotoAndPlay(2);
}
}

Step 9

Insert a new layer and name it object.

Step 10

Draw any "shape" that would represent our "object". For this example, I have drawn this:



Step 11

Select the "object", and press F8 key, to convert it into a Movie Clip.



Step 12

Double click on a new made Movie Clip to go in its inside. After that, while your "object" is still selected, press again F8 key to convert the "object" into a Graphic Symbol.

Step 13

Then, set the object on the position where we have placed the first text (button), on the top of stage. See the picture below.



Step 14

Click on frame 12 , and after that on frame 24, and press F6. Then, go back on frame 12, and set the "object" on the position like it is shown on the picture below.



Step 15

Go back on frame 1, and frame 12, and in Properties Panel (Ctrl+F3), under Tween choose Motion.



Step 16

Insert a new layer and name it action.

Step 17

Click on frame 12 and 24, and press F6 key. Then, go back on frame 1, 12, and 24, and for every frame, open the Action Script Panel (F9), and paste this script:

stop();



Step 18

Go back on the main scene, select the "object", open the Properties Panel (Ctrl+F3), and under <Instance Name> type object.



We're done!

Download source file (.fla)

Have questions about this tutorial?
Visit our friendly Community Forums!
Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!

Top tutorials

1. Advanced full flash site - Part 1
Total views: 221534

2. Water effect
Total views: 166040

3. Photo slide show
Total views: 153640

4. High-tech city animation
Total views: 151459

5. Special Picture Effect
Total views: 146246

Related links