Very noobish question(dont laugh), how to use sounds?

Actually i dont have any idea how to make sounds work with movieclips, and how to control them via AS(AS2), so please give me all the resources tutorial and help you can about using sounds and controlling them via code.

In this case however i need to play a small sound on hitTest with a movieclip, how do i do that exactly?

Offtopic: what will be a good place to get some roalty free sounds for background music and effects?

Heres my way:

First import the sound into your library (duh)

Now right-click on it, select Linkage, check the Export for AS2/AS3 option and type in your Linkage Name

Go back to your stage, select a frame and right-click for Actions

Type in this code:

var btnsound = new Sound();
btnsound.attachSound(“yoursoundslinkagename”)

Now, if you want to play this sound when the user rolls over a button do this:

on(rollOver) {
_root.btnsound.start(0,1)
}

This is play the sound once. If you want to loop the sound, just change the 1 into how many times you want looped. Obviously, you can change the rollOver option for almost anything. Hope this helps

PS: Flashkit.com or Sounddogs have really good sound banks.

If you don’t want to have it exported in the first frame (crap for preloader) uncheck that checkbox in linkage and have it play on a intermediary unused frame as “event”

on(rollOver) {
_root.btnsound.start(0,1)
}

Try to avoid using Actionscript 1 and _root though :stuck_out_tongue:

All problems are solver thanks to both of you!!..now, a bit of topic, i need some sound effects, can you please help me search for it?
telephone ringing-- "tring trrring"
Slob — as if a wet cloth struck something
And a dissolving sound when changing scenes.—“shooosh”

If you find a link for this, please provide it.

As I said, you should try Flashkit or Sounddogs, but heres a few sounds you mentioned:

Telephone Rings:

http://flashkit.com/search.php?cat=soundfx&per=10&page=1&term=Telephone

Scene Change:

http://www.flashkit.com/soundfx/Interfaces/Zoops/vwoom-Public_D-148/index.php

http://www.flashkit.com/soundfx/Interfaces/Zoops/Vwoom-Public_D-218/index.php

Thats all I can find for now.

Ok now i have another problem…

I have a background sound that i want to play throughout the game, but i want to lower its volume during the gameplay. I got it to work this far…but then,when i try to set the volume of my bullet sound bullet.setVolume(20); the background sound also gets set to 20…how can i change only one sound’s volume?

when you declare a sound attach it to a timeline (a movieclip)

var btnsound = new Sound(this_mc);

if you do not put anything between the brackets it attaches it to main time line

when you lower the volume all sounds in one timeline are effected

i personnally createempty movie clips to hold all my sounds

try http://kennybellew.com/tutorial/ for all sound advice