5 Replies Latest reply on Jun 20, 2007 6:00 PM by kglad

    Two buttons Play/Pause Sound; What am I doing wrong

    tedh7 Level 1
      I've got two sound buttons: btnPlay and btnPause with the following code which is bombing.
      Any idea of what I'm doing wrong?--Thanks!

      btnPlay.addEventListener(MouseEvent.CLICK, PlayWelcome);
      function PlayWelcome(event:MouseEvent, pausePosition):void {
      SoundMixer.stopAll();
      var mySound:Sound;
      mySound=new Sound(new URLRequest("A_INTRO1.mp3"));
      var pauseChannel:SoundChannel=mySound.play();

      if (pausePosition!==0){
      channel=mySound.play(pausePosition);
      }
      }

      btnPause.addEventListener(MouseEvent.CLICK, PauseWelcome);
      function PauseWelcome(event:MouseEvent):void {
      var pausePosition:int=channel.position;
      channel.stop();
      }