Sound Control In Flash – Tutorial and Downloads

by Hiroshi on October 20, 2008

in Adobe Flash, Control, Sound

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.

Download Example

Buttons Bar Rollover Sound Control

- Exported from library
- Fade in out
- Plays from where it was stopped
- Buttons rollover volume control

Download Example

Slider Sound Control With Button

- Exported from library
- Fade in out
- Plays from where it was stopped
- Sliderbar Control

Download Slider Volume Control

On Off Text – Internal Sound – Cross Fade

- Fades in out
- Plays from where it was stopped
- On Off text display
- Single Button on off control

Download Example

Single Sound – Internal Sound – Cross Fade – Moving Bars

- Fade in out
- Plays from where it was stopped
- Moving Bars
- Single Button on off control

Download Example

Single Sound – Internal Sound – Cross Fade – Static Bars

- Fade in out
- Plays from where it was stopped
- Static Bars
- Single Button on off control

Download Example

Single Sound – Internal Sound – Vertical Bar Control

- Vertical Bar control
- Internal Sound

Download Example

Single Sound – Vertical Bar Control/On Off Button – Cross Fade – Moving Bars on off

- Vertical Bar control + Button Control
- Moving bars which behave with on off
- Cross Fadeing Sound

Download Example

Play External MP3 Sound Without Loading

This Player has On, Off, Next, Forward buttons and can play many MP3 sounds from outside but it will not preload these sounds.

Download Example

Multiple Sounds CrossFade

Multiple Sounds – Crossfade – Slider Bars – On Off Button

Download Example

Sounds Tutorials Resources

http://kennybellew.cowfly.com/tutorial/index.html

Equalizer Bars For Sound

Download Files

Download Files

Related Posts

Previous post:

Next post: