3 Replies Latest reply on Nov 9, 2007 7:47 AM by kglad

    scripting issue on 2-sound object

    hmcka
      okay. bear with me. both this forum and action scripting are new to me.

      i have a button that i've applied action script to. i want the button to play one sound on mouse rollover and a different sound on mouse click. this part i got. the script to that is...

      one scene one, first frame I have:

      var fedGov_sound1:Sound = new Sound(_root);
      fedGov_sound1.loadSound("InThisLessonOnly.mp3", false);

      var fedGov_sound2:Sound = new Sound(_root);
      fedGov_sound2.loadSound("InThisLesson.mp3", false);

      stop();

      i also have script on the object that's in the same frame:

      on (rollOver) {
      fedGov_sound1.start();
      }
      on (rollOut) {
      fedGov_sound1.stop();
      }

      on (release) {
      fedGov_sound2.start();
      fedGov_sound2.loadSound("InThisLesson.mp3", true);
      }



      this works, but the second sound is much longer than the first, so if you rollover the button again while the second sound is still playing both play simultaneously. i thought i could script something like if the second sound playing is true, then don't play the first sound. the script i have follows.

      on scene one, frame one:

      var fedGov_sound1:Sound = new Sound(_root);
      fedGov_sound1.loadSound("InThisLessonOnly.mp3", false);

      var fedGov_sound2:Sound = new Sound(_root);
      fedGov_sound2.loadSound("InThisLesson.mp3", false);

      stop();

      on the object i have:

      on (rollOver) {
      if (fedGov_sound2.loadSound("InThisLesson.mp3", true));
      fedGov_sound1.stop()
      } else {if(fedGov_sound2.loadSound("InThisLesson.mp3", false);
      fedGov_sound1.start()
      }

      on (rollOut) {
      fedGov_sound1.stop();
      }
      on (release) {
      fedGov_sound2.start();
      fedGov_sound2.loadSound("InThisLesson.mp3", true);
      }

      i get an error message, but i don't know enough about action scripting yet to understand what it says. any suggestions?

      thanx,
      hmcka