1 Reply Latest reply on Feb 28, 2008 7:58 PM by binkerboy

    Changing volume over time

      In my application, a mouseover event cause an mp3 to play. Mouseout stops it. I want the sound to play, but slowly increase in volume from 0 to .5. On mouseout I want the sound to decrease slowly to 0. I can set the soundtansform to .5 and the sound loads and plays fine. Where I am stuck is on the slow fade in and out. I guess I am looking for a counter of some kind in AS3 that allows me to gradually do this in the function over time.

      I also don't compute the "use "Attach Code" " instruction when posting, so here is my code.

      public var shuttleChannel:SoundChannel = new SoundChannel();
      public var s:Sound;
      public var trans:SoundTransform = new SoundTransform(.5, 0);

      private var browserManager:IBrowserManager;

      public function bringShuttleUp(e:Event):void
      setChildIndex(ShuttleBG,numChildren - 1);
      ShuttleBG.alpha = .5;

      s = new Sound();
      var req:URLRequest = new URLRequest("assets/sounds/talk14_countdown_T-min_mod.mp3");
      var context:SoundLoaderContext = new SoundLoaderContext(8000, true);
      s.load(req, context);
      shuttleChannel = s.play();
      shuttleChannel.soundTransform = trans;


      public function putShuttleBack(e:Event):void
      ShuttleBG.alpha = 1;