Search:                                                     

[index_add/searchmain.htm]
[pages/search_page.htm]
Adding Sound To A Button
 
 

This tutorial will show you exactly how to add sounds to a button. Before we begin, if you don't know how to create a button, please read the tutorial on creating buttons first by clicking here

The animation below will show you how your final example will look like. Move the mouse over the button to hear a sound and click on the button (circle) to hear another sound as well.

Adding The Sound:

Since making you create the button from scratch would be highly inefficient; for you are only interested in adding sounds to a button. So, please download the button source code. Don't worry, the sound will have to be added in by you with the information contained below. Click here to download the source.

Here's How:

  1. Once you have opened the file "be.fla" that you downloaded from my site, you should simply see a circle just like my example above. To add the sound, first right click on the Circle (button) and choose Edit. Once you have done that, you should see the modified timeline to accommodate the button. Insert a new layer above "Layer 1" and call it sound. See image below:

  1. Now, what we want is to have a sound playing when the user moves the mouse over the button, and a sound should play when the user clicks on the button. So, right click on the frame "Over" in the Layer "sound" and Insert Keyframe. Insert a keyframe in the frame marked Down as well. The keyframes should be hollow.
     
  2. The final step is to drag and drop a sound into the Over keyframe and the Down keyframe in the "sound" layer. So, click on Window > Common Libraries > Sounds. You should see the Library window with all the sounds installed by Flash. See image below on how to get to the Common Library:

  1. All you have to do now is simply drag and drop. Click on the Over keyframe and drag the sound "Brick Drops" onto the animation. Then click on the Down keyframe and drag the sound "Industrial Door Switch" onto the animation. Now you should have a sound on each keyframe for Over and Down. Your timeline should resemble that of mine below:


 

You can preview the animation and move and click the mouse on the animation to see the sounds that you added to the button. That is all there is to adding sounds to buttons. To double check your button to the final button of mine, simply click here. (The file is about 134K in size)

I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.

The following is a list of related tutorial and help resources that you may find useful:

How to use the Forums
New, Upcoming, and In-Progress Tutorials
How to Help out kirupa.com
Writing Tutorials
 
Cheers!
Kirupa Chinnathambi
kirupaBlog
[pages/rightinfo.htm]

 

  schematic:
   Button/Sound
  Partial Source
  Final Source
   

 navigation:

tutorials:
Flash 5
  Basic
  Animation
  Special Effects
  Advanced
  Screenshots
  Forums
  Buy Flash 5
ActionScript
Flash 4
Flix
Other Tutorials
books:
FrontPage 2002: ABG
Flash Books

features:

[pages/gl.htm]
 
 

 
 updates:

The following links are tutorials that have been added or updated recently to this site:

  Duplicate Movie
Collision Detection
Add Sound
Swap Depth
Falling Snow
 
[media/forum.htm]

 

Return to Previous Page
 

[developer/flash5/copyright.htm]