# Problems setting the volume to a sound object.Plz help me!

**URL:** <https://forum.kirupa.com/t/problems-setting-the-volume-to-a-sound-object-plz-help-me/230192>\
**Category:** flash\
**Created:** [June 23, 2007, 7:43pm UTC](https://forum.kirupa.com/t/problems-setting-the-volume-to-a-sound-object-plz-help-me/230192 "2007-06-23T19:43:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecptavares](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ecptavares](https://forum.kirupa.com/u/ecptavares)\
**Post date:** [June 23, 2007, 7:43pm UTC](https://forum.kirupa.com/t/problems-setting-the-volume-to-a-sound-object-plz-help-me/230192/1 "2007-06-23T19:43:53Z")

</div>

Hi!

I am trying to make a volume control in my flash movie with actionscript 2.0

Here is my code:

```auto

var s : Sound = new Sound();
var volPos : Number = 20;

s.setVolume(volPos);

btBaixa.onRelease = function()
{
    if(volPos > 0){
     volPos -= 10;
    }
    s.setVolume(volPos);
}

btAumenta.onRelease = function()
{
    if(volPos < 100){
     volPos += 10;
    }
    s.setVolume(volPos);
}

```

but the problem is the first time I lanch my movie it comes in a good volume.As soon as I hit the up or down button to lower or increase the volume firts the volume goes down a lot and then starts to increase or decrease its volume.

What is wrong with it?
