0 Replies Latest reply on Oct 16, 2010 5:56 AM by proyb

    Fade out MP3 individually


      Tie this code to a button, if I repetitive press as  fast as I can, an error exception would appear in the application. I  found that it would not throw an error if I stop the sound when it  completely fade out. However, I wish the fade out function could stop  the sound individually, not stop o1_1 together. Similar to a piano keyboard, how do I do that?

      private var s1_1:Sound = new Sound();
      private var o1_1:SoundChannel = new SoundChannel();

      private static const a1_1:String = "1.mp3";

      function p1_1():void{
      = new Sound();
      .load(new URLRequest(a1_1));

      private function fade1_1():void{
      TweenMax.to(o1_1, .35, {volume:0, onComplete:stop1_1});

      private function stop1_1():void {
      //if I add, this code would only stop the sound altogether rather than individual. I wish to have each of the instance stop itself.

      My error exception in Flex builder 3 using SDK 3.5 and AIR 2.0:
      [SWF] snd.swf - 1,022,361 bytes after decompression
      TypeError: Error #1009: Cannot access a property or method of a null object reference.
           at snd/st1_1()[...snd.mxml:44]
           at snd/___snd_Button1_mouseUp()[...snd.mxml:67]