Sound Question

This may sound a bit stupid of me to ask, btu how do you add a sound when you press down on or release a button. Thanks.

Oh yeah, I forgot to say that the buttons are located within a mc if that matters. Anyway to do it completely with as?

yeah. import the sound to your library, and set the linkage for “sound”. on the first frame of the main timeline
[AS]
mySound = new Sound (this);
mySound.attachSound(“sound”);
[/AS]

on the play button
[AS]
_root.mySound.start(0, 99);
[/AS]

on the stop button
[AS]
_root.mySound.stop()
[/AS]

this has a bug though, it you keep pressing play, the sound start again (I think, not totally sure). If it does, then you can add
[AS]
mySound.stop()
[/AS]
to the play button

It didn’t work for some reason. Any other way to do this, even if it’s nto with as. Because the buttons link to pages and I wante d a click noise to play on release. Thanks btw

this should work. did you set up the linkage right?

Oooh before I didnt know what you meant by linkage. Lemme see if it works now.

How do you get it to stop? I tkeep playing

what do you mean? if you want it to stop after 1 loop, change the number 99 to 0. 99 is the number of times to loop

Ooooooh,t hansk so much

yup

BTW, if I want to change the name of teh linkage to lets say “click” what parts of teh as would i change?

Oh yeah, one more quick question. How do you control teh volume of a sound? I ask this because I want to change the current loop playing method for my music I am using now to a as one like teh one above. However, i wnated it to be named “music” in teh linkage and I wnated it ot play at about 50% volume. Then I woudl change the “sound” to “click”. Anyway to do that? Thanks a lot for all your help.

there is another easy way around which is not actionscripted (but I recommend the actionscripted one =))

take your sound library, check the button and go to the onmouseover or onclick frame (2nd or 3rd frame) and drag the sound in the work area. You should see a wave pattern in your timeline frame…

mySound.setVolume(50);

[AS]
mySound = new Sound (this);
mySound.attachSound(“sound”);
[/AS]

When you change the linkage, just change where it says “sound” in that line above to “click” or whatever you wanted.

Thansk so much everyone. I lvoe this site lol. :beam: . I finally completed teh sound aspect of my site yay.