How do I set volume?

How to I set the volume of an mp3 when it first loads on to page? I’m not concerned about making a volume bar I just want to make the volume lower.

this is how I have set up my music at the moment:

var s:Sound = new Sound(new URLRequest("5.mp3"));
var sc:SoundChannel = s.play(0, 99);
sc.soundTransform = new SoundTransform(0.1,-0.2);

s.volume = int;

replace int with a number of your choice, try .3

thanx alot

no probs man, let me know if it works

it didn’t work came back with this error.

Access of possibly undefined property volume through a reference with static type flash.media:Sound.

sc.volume = 0.3; is how i put it in.

try just .3, without the 0

still the same problem??

Any chance I could take a look at the files??

sure think man here a link.
http://www.arctosdesign.com/sound.zip

something’s messed up with that man, tried opening it on my pc and my macbook

ok try this
http://arctosdesign.com/music.zip

Nope sorry man, what you using??

mac or pc?

mac and it still not working? ok ill put up fla and the song:
http://arctosdesign.com/sound.fla

http://www.arctosdesign.com/5.mp3

Try sending the SoundTransform object to the play function:


var s:Sound = new Sound(new URLRequest("5.mp3"));
var st:SoundTransform = new SoundTransform(0.3, -1);
var sc:SoundChannel = s.play(0, 99, st);

Or you could try:

var st:SoundTransform = sc.soundTransform;
st.volume = volume;
sc.soundTransform = st;

Where volume is some number between 0.0 and 1.0 - whether you have a leading 0 in front of the decimal point is up to you - it’s just for readability. Personally, I always prefer them because it makes seeing a number less than 1.0 easier :slight_smile: