2 Replies Latest reply on Sep 8, 2006 1:03 PM by csharvey

    Sound Play/Pause

    csharvey
      Hi all,

      I'm sure this is very simple to do but I am new to Director. I'm using Director MX2004 and I am trying to create a multistate button that pauses Channel 1 when pressed, then continues when pressed again. I know I can use the following lingo to pause the sound Channel but I don't what to do to continue.

      on mouseUp me
      sound(1).pause()
      end

      Can anyone help me out with what I need to add to be able to resume playback? I can't use soundEnabled or even stop since this project relies on the sound for navigation purposes. I just need to pause and then play sound channel 1 from one button.

      Thanks for the help!

      Chris
        • 1. Re: Sound Play/Pause
          Level 7
          Found this by tcoursey on mediamacros (www.mediamacros.com):

          global tm
          global paused
          global soundfile

          on beginsprite
          paused = 0
          end

          on togglesound
          soundfile = sound(1).member
          if paused = 0 then
          tm = sound(1).currenttime
          sound(1).pause()
          paused = not (paused)
          else if paused = 1 then
          sound(1).play([#member: member(soundfile), #startTime: tm])
          paused = not (paused)
          end if
          end

          on mouseup
          togglesound
          end
          • 2. Re: Sound Play/Pause
            csharvey Level 1
            THAT DID IT!

            Thank you for the help, I really appreciate it.

            Chris