Sound Control In Flash – Tutorial and Downloads

We can import any sound of supported format into flash (Shortcut: Ctrl+R). After importing, you can find sound in Library panel and by dragging that at stage it will be added in timeline of movie. Other way is to click at timeline which will give you sounds panel in movie properties panel, if you have imported sounds into your movie. You can select any sound from there and add into your movie. By selecting any sound it further provides some options of Effects and Sync. By effects you can select left or right channel sound or sound fade in, fade out effect. By Sync you can select event, start, stop, stream options for selected sound and loop option or repeat times . Event sound is normal while stream sound is streamed when movie is played, if the movie is paused then stream sound will be paused also. Stream sound option is for synchronizing sound with visual animation where you need sound along with animation effects. If you need a loop sound, and you have a music loop and you want it to be played again and again then select event or play and select repeat and put value of 999 in repeat times. If you select stream sound, you will have to add frames to the sound till it ends and also we do not give repeat times to a streaming sound usually.

Now lets get started. I have some cool sound implementation examples here.

Simple Sound Control On/Off

For simple sound control we need two buttons and two frames.
One frame containing sound and second one empty with a blank keyframe.
Now when we want to start a sound we need to click the button which will have a simple action
i.e.

gotoAndStop(2);

While at frame 2 sound is placed and suppose that the loop and it will repeat on until it is stopped.

Now if we need to stop that sound then we need a button with the following actionscript

gotoAndStop(3);
stopAllSounds();

While frame number 3 is blank key frame. And we can implement this by creating a movie clip and these two frames, sound and buttons in that movie clip and that can be always available for whole movie and whenever we can trigger sound to be stopped or played.

This example is very basic and does not deals with advanced issues relating to sound. We can control sound by fancy bars, We can gradually decrease and increase sound level. Examples below explain advanced control of sounds.

Fade in Out, On/Off Single Sound

– Single Sound
– Sound exported from library
– On/Off – Fade in out
– Sound starts again at the point from where it was stopped before after fade out to fade in.