1 Reply Latest reply on Jan 26, 2007 7:44 AM by kglad

    Need help fading out a sound object.

    i am justin hines
      On the first frame of my movie i have the following:

      mySound = new Sound();
      mySound.attachSound("music");
      mySound.start("", 999); // starts background music

      myVoice = new Sound();
      myVoice.attachSound("voice");


      Later in the movie i have

      myVoice.start("", 1); // play voice over




      Shortly followed in another frame by:

      this.onEnterFrame = function(){ // assign fade out code to onEnterFrame event
      // configure
      so = mySound; // set target path to desired sound object
      rate = 5; // choose number between 1 and 100

      newVolume = so.getVolume() - rate; // subtract rate from current volume
      if(newVolume > 0) { // continue fade
      so.setVolume(newVolume); // set newVolume to decrease volume

      } else { // fade complete
      so.setVolume(0) // reset to 0 to prevent negative values
      this.onEnterFrame = null; //stop loop
      }
      }


      When the fade out code runs, it fades both the background music and the voice over. What i want is the background music to fade out while the voice over plays at full volume.


      Any help would be greatly appreciated.