# Global sound reducing volume - problem when moving back n forth between frames

**URL:** <https://forum.kirupa.com/t/global-sound-reducing-volume-problem-when-moving-back-n-forth-between-frames/223440>\
**Category:** Uncategorized\
**Created:** [April 22, 2007, 8:49pm UTC](https://forum.kirupa.com/t/global-sound-reducing-volume-problem-when-moving-back-n-forth-between-frames/223440 "2007-04-22T20:49:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robtyketto](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@robtyketto](https://forum.kirupa.com/u/robtyketto)\
**Post date:** [April 22, 2007, 8:49pm UTC](https://forum.kirupa.com/t/global-sound-reducing-volume-problem-when-moving-back-n-forth-between-frames/223440/1 "2007-04-22T20:49:10Z")

</div>

Hi,

I have a mute button in my game, it works on the inital frame (titlepage) and the main game page.

However when the user quits back to the title page, odd behavious happens.  
To diagnose I traced the volume (as this is how I toggled the sound on/off)

See code below:-

```auto
 
var globalVolume:Sound = new Sound();
 globalVolume.setVolume(50);
 
//Key Listener to allow sound volume to be 0/50 to mimic a mute button 
keyslistener = new Object();
keyslistener.onKeyDown=function(){
   if(Key.isDown(83)) 
  {
   keypress = "on";
   globalVolume.setVolume(50-globalVolume.getVolume());
   trace(globalVolume.getVolume());
  }
}

```

Initally the code worked as expected showing the toggle off volumes 0,50,0,50 etc…, until I quit the game and then it would print 0 & 50 on one single keypress.

Can anyone shed some light? It appears as if there are two ‘groups’ of sounds running.  
[Confused.com](http://Confused.com) :book:

Thanks  
Rob
