4 Replies Latest reply on Aug 10, 2010 9:06 AM by DarioC

    Sound fade + other action

    DarioC

      I´m using this AS2 script for fading in and out my sound when clicking on buttons. It work really nice:

       

      some_sound = new Sound();
      some_sound.attachSound("my_music.mp3");
      some_sound.start();
      some_sound.setVolume(100);
      //
      function increase_volume() {
      counter++;
      some_sound.setVolume(counter);
      if (counter>=100) {
      clearInterval(my_int);
      }
      if (counter<=0) {
      clearInterval(my_int);
      }
      }
      //
      function decrease_volume() {
      counter++;
      some_sound.setVolume(100-counter);
      if (counter>=100) {
      clearInterval(my_int);
      }
      if (counter<=0) {
      clearInterval(my_int);
      }
      }
      //
      fade_out_btn.onRelease = function() {
      counter = 0;
      my_int = setInterval(decrease_volume, 10);
      };
      fade_in_btn.onRelease = function() {
      counter = 0;
      my_int = setInterval(increase_volume, 10);
      };

       

      Now I need to jump to another frame when then fade-out sound is over. How can I do that?

      I tried to add some code below the "if (counter<=0)" but it does´t work. Any idea?