Flashvault.net

Turn on/off sound in flash

13.8.2006, 2:16    Total views: 48735
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!

Forum - Newest Discussions

refresh xml with updated xml
Last post by: happinessclover
Date: 18.08.2008 02:45:57

convert excell spreadsheet to flash
Last post by: benjezza
Date: 06.08.2008 09:34:41

Need help for xml for flash!
Last post by: happinessclover
Date: 03.08.2008 16:33:06

I need help for my flash actionscript
Last post by: Web_designer090
Date: 02.08.2008 09:28:48

Problem with tutorial on this site
Last post by: 42kang
Date: 16.07.2008 17:12:23

preloader
Last post by: singh
Date: 13.07.2008 11:57:12

Flash actionscript question! i need help!!
Last post by: happinessclover
Date: 03.07.2008 16:21:21

Advanced Full Flash Site - Movie Clip as Button?
Last post by: hawttdawgg
Date: 01.07.2008 20:11:05

Contact Flash Form
Last post by: popsiz
Date: 17.06.2008 10:45:59

Related links