Daimz
June 8, 2008, 5:26pm
1
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
no probs man, let me know if it works
Daimz
June 8, 2008, 5:45pm
5
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
Any chance I could take a look at the files??
Daimz
June 8, 2008, 6:18pm
9
Garfty
June 8, 2008, 6:23pm
10
something’s messed up with that man, tried opening it on my pc and my macbook
Daimz
June 8, 2008, 6:31pm
11
Garfty
June 8, 2008, 6:34pm
12
Nope sorry man, what you using??
mac or pc?
Daimz
June 9, 2008, 12:04am
13
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