Wednesday, 21 May 2008

Add sound to a button

In this Flash tutorial you will learn how to add sound to a button. This tutorial is useful if you want to create a mouse over sound effect that can be used in flash websites, applications and games. For this tutorial i have used a sound effect of a cow which is avaiable at: www.findsounds.com

Adding sound to a button

Step 1

Create a new flash document.
Import your audio file into the library by selecting File > Import > Import to library then select your audio file and click ok.


Step 2

Create your button on the stage. I made a basic rectangle shape with a green colour and black stroke,but you can make whatever kind of button you wish.



Using the selection tool (v) select your button.
Convert it into a symbol by pressing F8 then give your symbol an appropriate name and check the “button” button then click ok.


Step 3

Double click on your sound button and your timeline should look like below:



Now select the over state and create a new key frame by selecting F6.


Step 4

With the over state selected go to the bottom of screen and choose your audio file from the drop down menu.




Step 5

Test your movie Ctrl + enter and move your mouse over the button.



You should now have a button with sound. Feel free to contact me for any questions or comments and remember to subscribe.

9 comments:

Sara S. 6 October 2009 at 14:58  

Thanks for the great tutorial! I have a question.. How do you make sure the sound doesn't overlap? Like in the instance where the cursor goes over the button more than once - the sound turns into a real mess. I'd like o create a sound button that plays the sound once when you put your cursor over it and stops playing it when your cursor leaves the button. Makes sense? I've researched this a LOT and cannot figure it out. Thanks!

Sara

iliketo 7 October 2009 at 02:38  

@Sara.s

You can try disabling the button with the 'enabled' property.

Anonymous 3 November 2009 at 23:50  

thanks for the easy to follow tutorial. I managed to create the button in less than a minute!!!

tammy 3 November 2009 at 23:51  

brilliant. got it done in two minutes

Anonymous 14 December 2009 at 11:32  

This is brilliant thanks.

Would you mind please explaining where I can find the 'enabled' property? Sorry - I only know basic Flash.

I need the sound to stop when the button is no longer being rolled over.

iliketo 14 December 2009 at 14:20  

@Anonymous

You don’t need to find the enabled property. Buttons and movie clips have properties you can change.

For Actionscript 2.0 use the following:

yourButtonInstanceName._enabled = false;

And for Actionscript 3.0 use the following:

yourButtonInstanceName.enabled = false;

Here are some links with information on the enabled property.

1.http://bit.ly/5ydXlL
2.http://bit.ly/4svwcs

LHamels 16 October 2011 at 19:02  

Thank you!!!!!

Now i can make a soundboard!!! ;D

iliketo 17 October 2011 at 01:38  

@LHamels

I already have a soundboard tutorial for AS2 and AS3.

Matt Junior 30 June 2013 at 17:45  

This is just what I'm looking for. Straight to the point. Thanks :)

  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP