# Fading sound with GTween

**URL:** <https://forum.kirupa.com/t/fading-sound-with-gtween/296120>\
**Category:** flash\
**Created:** [September 9, 2009, 7:24pm UTC](https://forum.kirupa.com/t/fading-sound-with-gtween/296120 "2009-09-09T19:24:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Optima](https://avatars.discourse-cdn.com/v4/letter/o/58f4c7/32.png) [@Optima](https://forum.kirupa.com/u/Optima)\
**Post date:** [September 9, 2009, 7:24pm UTC](https://forum.kirupa.com/t/fading-sound-with-gtween/296120/1 "2009-09-09T19:24:50Z")

</div>

Hey -

I’m having an issue with fading sounds with GTween, can anyone let me know what I’m doing wrong here? Thanks in advance.

```auto

        public function playBackgroundSound ( s : Sound ) : void
        {
            bgst = new SoundTransform( __volume );
            bgsound = s;
            bgchannel = bgsound.play(0, 999);
            bgchannel.soundTransform = bgst;            
        }

        public function set volume ( isIt : Number ) : void { 
                
            if ( isIt == 0 )
            {
                var soundOutTween : GTween = new GTween ( bgst, 1, {volume: 0});
            }
            else {
                var soundInTween : GTween = new GTween ( bgst, 1, {volume: 1});
            }
            
            __volume = isIt ; 
        } 

```
