# How do I set volume?

**URL:** <https://forum.kirupa.com/t/how-do-i-set-volume/262651>\
**Category:** Uncategorized\
**Created:** [June 8, 2008, 5:26pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651 "2008-06-08T17:26:53Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 8, 2008, 5:26pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/1 "2008-06-08T17:26:53Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![Garfty](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Garfty](https://forum.kirupa.com/u/Garfty)\
**Post date:** [June 8, 2008, 5:40pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/2 "2008-06-08T17:40:24Z")

</div>

s.volume = int;

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

---

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 8, 2008, 5:41pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/3 "2008-06-08T17:41:16Z")

</div>

thanx alot

---

<div class="post-metadata">

**Author:** ![Garfty](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Garfty](https://forum.kirupa.com/u/Garfty)\
**Post date:** [June 8, 2008, 5:43pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/4 "2008-06-08T17:43:24Z")

</div>

no probs man, let me know if it works

---

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 8, 2008, 5:45pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/5 "2008-06-08T17:45:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Garfty](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Garfty](https://forum.kirupa.com/u/Garfty)\
**Post date:** [June 8, 2008, 5:49pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/6 "2008-06-08T17:49:54Z")

</div>

try just .3, without the 0

---

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 8, 2008, 6:03pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/7 "2008-06-08T18:03:16Z")

</div>

still the same problem??

---

<div class="post-metadata">

**Author:** ![Garfty](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Garfty](https://forum.kirupa.com/u/Garfty)\
**Post date:** [June 8, 2008, 6:04pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/8 "2008-06-08T18:04:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 8, 2008, 6:18pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/9 "2008-06-08T18:18:58Z")

</div>

sure think man here a link.  
[http://www.arctosdesign.com/sound.zip](http://www.arctosdesign.com/sound.zip)

---

<div class="post-metadata">

**Author:** ![Garfty](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Garfty](https://forum.kirupa.com/u/Garfty)\
**Post date:** [June 8, 2008, 6:23pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/10 "2008-06-08T18:23:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 8, 2008, 6:31pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/11 "2008-06-08T18:31:19Z")

</div>

ok try this  
[http://arctosdesign.com/music.zip](http://arctosdesign.com/music.zip)

---

<div class="post-metadata">

**Author:** ![Garfty](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Garfty](https://forum.kirupa.com/u/Garfty)\
**Post date:** [June 8, 2008, 6:34pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/12 "2008-06-08T18:34:56Z")

</div>

Nope sorry man, what you using??

mac or pc?

---

<div class="post-metadata">

**Author:** ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)\
**Post date:** [June 9, 2008, 12:04am UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/13 "2008-06-09T00:04:39Z")

</div>

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

[http://www.arctosdesign.com/5.mp3](http://www.arctosdesign.com/5.mp3)

---

<div class="post-metadata">

**Author:** ![littlespex](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@littlespex](https://forum.kirupa.com/u/littlespex)\
**Post date:** [June 9, 2008, 12:54am UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/14 "2008-06-09T00:54:31Z")

</div>

Try sending the SoundTransform object to the play function:

```auto

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);

```

---

<div class="post-metadata">

**Author:** ![dthought](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dthought/32/3573_2.png) [@dthought](https://forum.kirupa.com/u/dthought)\
**Post date:** [June 9, 2008, 1:41pm UTC](https://forum.kirupa.com/t/how-do-i-set-volume/262651/15 "2008-06-09T13:41:01Z")

</div>

Or you could try:

```auto
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 🙂
