PDA

View Full Version : button sounds


tvek-amino
10-10-2002, 08:47 PM
ive been lookin at this tutorial.. http://www.flashkit.com/tutorials/Audio/Flash_MX-Kenny_Be-824/index.php
and its pretty helpful, but considering im like an idiot or sumthin, i still cant figure out how to simply make a sound when u click a button.. the tutorial says a lot about how u need to 'define the sound' but not much on how to actually going about doing so, somebody please walk me thru this..

flx
10-10-2002, 09:24 PM
I'm limited to flash 5- but heres how i'd simply add sound to a button for clickin purposes.

In flash 5 your basic button has four states of "existence" :rolleyes: .
Anyways.. I take it you know about these already but hey i'll state them anyways.. Up, Over, Down and Hit.

You have imported your sound and so it now sits in the library. Great!
All you need to do is stick it to a button. So, select the chosen button and open it up for editing.
[Confused? Well simply single click on the desired button --> go to 'Edit' on the menu and select 'Edit Symbols'.]

You should see the four 'states' in the timeline. Since you require the sound to occur when the button is clicked you will need the down state.
So, open the library and click & drag the music on to the timeline, underneath 'Down'.

Test the movie ['ctrl' + 'Enter']. The button should now annoyingly make noise whenever you click it. :D

Hope this helped and apologies if it didn't.

NB.To the pro's out there: I'm a newbie - think you can do better!?? Go ahead! :p

ScratUAD
10-12-2002, 01:12 PM
do edit a button... while you are editing you can double click the thing till the timline becomes what looks like 4 large frames... with "up" "over" "down" and "hit"
those are the 4 button states...
to make a sound play:
"onMouseOver" then drag the sound to the "over" frame...
"onMouseClick" or "onMouseDown" drag it to the down frame....
pretty easy eh?
no need to define a sound... just use the file menu and the "import to library" option and import your button sound.

getpaid2share
11-17-2005, 05:17 AM
do edit a button... while you are editing you can double click the thing till the timline becomes what looks like 4 large frames... with "up" "over" "down" and "hit"
those are the 4 button states...
to make a sound play:
"onMouseOver" then drag the sound to the "over" frame...
"onMouseClick" or "onMouseDown" drag it to the down frame....
pretty easy eh?
no need to define a sound... just use the file menu and the "import to library" option and import your button sound.

The biggest thing for people learning flash is the complication of the explanations. I have to admit to a lil confusion after reading what sounds Sooo simple.

And Im sure that when you're Good at what you do it's so simple to you, that explaining it is more difficult then doing it.

So my question - just because I'd like some clarity not only for me but anyone else is, what exactly do you mean by "onMouseOver" then drag the sound to the "over" frame....?

Are you saying that in the ActionScript you write out the code "this_btn.onMouseOver" and by having the sound positioned under the "over" that it will automatically play the sound?

Where does a person put the "onMouseOver" command...?

For a site i'm working on currently I will most likely need to use more action script to get mine to play - here's a site with some sound on it when the mouse is "over" the button... http://www.coffeebycandlelight.com

Here's what i did.

1. I imported a sound to my library, and "right clicked" then selected "Linkage" - I checked the box for "export to Action script" - then in the "Identifier" box I named the sound file "Notify"

2. Then defined a variable called "btnsound" as the Notify sound.

var btnSound:Sound = new Sound();
btnSound.attachSound("Notify");
homeNav_btn.onPress = function() {
_root.gotoAndStop("cbcHome");
};
goShop_btn.onPress = function() {
getURL("cbcShop.htm");
};
contactUs_btn.onPress = function() {
getURL("cbcContact.htm");
};

This action script is actually defined Inside of the NavBar Movie.

Then on the button itself i place This code.

For example, On the button "homeNav_btn" I attatched the following script

on(rollOver){
btnSound.start();
}

Now, whenever you roll your mouse over each button, the "btnSound" variable is called, and the start(); command plays the sound.