# Sound on / off on videostream AS3

**URL:** <https://forum.kirupa.com/t/sound-on-off-on-videostream-as3/327235>\
**Category:** flash\
**Created:** [February 14, 2012, 9:39pm UTC](https://forum.kirupa.com/t/sound-on-off-on-videostream-as3/327235 "2012-02-14T21:39:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jungletactics](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jungletactics/32/3136_2.png) [@Jungletactics](https://forum.kirupa.com/u/Jungletactics)\
**Post date:** [February 14, 2012, 9:39pm UTC](https://forum.kirupa.com/t/sound-on-off-on-videostream-as3/327235/1 "2012-02-14T21:39:50Z")

</div>

Hi,

I tried building a sound on off button on a NetStream video.  
im able to switch the volume off but not back on again.

I’m not very good at coding and im sure im overlooking something really simple but i havent been able to figure out why the sound wont switch back on.

Maybe someone can show me where i went wrong with my code.

Thx in advance!

```auto
sound_btn.addEventListener(MouseEvent.CLICK, startStopSounds);

function startStopSounds(event:MouseEvent):void
{    
    if (ns.soundTransform.volume == 1)
        {ns.soundTransform = new SoundTransform(0);
    ns.soundTransform.volume = 0;
        trace("soundmutes");
}
    else if (ns.soundTransform.volume == 0)
{ ns.soundTransform.volume = 1;
        trace("soundplays");
}

}

```
