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

Turn on/off sound in flash

13.8.2006, 2:16    Total views: 99555
If we compare this tutorial with the previous two tutorials the difference is enormous. This tutorial gives us the chance to turn on and turn off the sound using play and stop buttons.



Step 1

Create a new Flash Document, click on file > Import > Import to Library and choose C:disk > Windows > Media > Windows XP Startup, to import a sound into a flash Library.





Step 2


Draw a "play" and "stop" buttons on the stage.

Step 3

After that select it (Ctrl+A) and press F8 on the keyborad (Convert to Symbol) to convert it into a Movie Clip. Look at the picture below!





Step 4

Double click on a new made Movie Clip (stop and play buttons) or right click and choose Edit in Place.



Step 5

Select the "play" button, and press F8 on the keyboard to convert it into a button. Look at the picture below!





Step 6

Select the "stop" button, and convert it into a button in an equivalent way like we have converted the play button.

Step 7

Insert a new layer and name it sound. Then click on the first frame of layer sound and using drag and drop technique move your sound (Windows XP Startup) from the Library on the stage.

Step 8

Click again on the first frame of layer sound, open the Properties Panel (Ctrl+F3), and under Repeat option set some huge number.

#ads#



Step 9

Insert a new layer and name it action.



Step 10

Take the Selection Tool (V), and do like it is shown on the picture below! (Select the second frame of all layers and press F6)



Step 11

Click on the first frame of layer action, open the Action Script Panel (F9), and paste this script:

stop ();

Step 12

Select the second frame of layer action, and paste this script:

stopAllSounds();

Step 13

Click on the first frame of Layer1, select the "play" button, and press Ctrl+B on the keyboard (Break Apart).



Step 14

While you're still on the first frame of Layer1, select the "stop" button, open the Action Script Panel (F9) and paste this script:

on (release) {
nextFrame();
}

Step 15

Click on the second frame of Layer1, select the "stop" button and press Ctrl+B on the keyborad to break it, like we have done for "play" button in step 13.

Step 16

While you're still on the second frame of Layer1 select the "play" button, open the Action Script Panel (F9) and paste this script:

on (release) {
prevFrame();
}

Test your movie (Ctrl+Enter).

We're done!

Bye!

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: 292571

2. High-tech city animation
Total views: 240563

3. Water effect
Total views: 224789

4. Photo slide show
Total views: 207516

5. Special Picture Effect
Total views: 183285



Related links