4 Replies Latest reply on Aug 21, 2007 5:22 AM by Newsgroup_User

    Pausing voiceover

    rafa@mediatech Level 1
      Hi:
      I've been working on a tutorial for a client in which I want the user to be able to pause the animation and voice over. I already figured out how to make the voice over pause once a button is clicked, and how to make it start in the same place it left off. The problem I am running into is that the voice over pauses, but the play head keeps going and keeps playing the animation.

      The code I am using to pause the voice over is:

      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("NAME"), #startTime: tm])
      paused = not (paused)
      end if
      end

      on mouseup
      togglesound
      end

      Thank you!
        • 1. Re: Pausing voiceover
          Level 7
          You can put this on any sprite but I tend to put it in the frame script
          spanning the animation but you can certainly add it to the sprite on which
          the togglesound handler is.

          property pPauseState

          on ToggleAnimation me, newState
          pPauseState = newState
          end

          on exitFrame me
          if pPauseState = TRUE then
          go to the frame
          end if
          end

          add this to the beginning of your togglesound handler OUTSIDE of the
          conditional statement.

          SendAllSprites (#ToggleAnimation, paused)

          Unless you need the paused global in other areas, I'd use it as a property
          for only the sprite on which the behavior sits.
          --
          Craig Wollman
          Lingo Specialist
          Word of Mouth Productions
          212-928-9581

          www.wordofmouthpros.com
          "rafa@mediatech" <webforumsuser@macromedia.com> wrote in message
          news:fac7kp$lt0$1@forums.macromedia.com...
          > Hi:
          > I've been working on a tutorial for a client in which I want the user to
          > be
          > able to pause the animation and voice over. I already figured out how to
          > make
          > the voice over pause once a button is clicked, and how to make it start in
          > the
          > same place it left off. The problem I am running into is that the voice
          > over
          > pauses, but the play head keeps going and keeps playing the animation.
          >
          > The code I am using to pause the voice over is:
          >
          > 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("NAME"), #startTime: tm])
          > paused = not (paused)
          > end if
          > end
          >
          > on mouseup
          > togglesound
          > end
          >
          > Thank you!
          >


          • 2. Re: Pausing voiceover
            James Newton, ACP Level 3
            You can find a number of sound behaviors, including a Play/Pause Sound behavior in the demo movie at http://nonlinear.openspark.com/tips/sound/panvolume/
            • 3. Re: Pausing voiceover
              Level 7
              "forum.macromedia.com" wrote:

              > You can put this on any sprite but I tend to put it in the frame script
              > spanning the animation but ....

              Hi Craig,

              I have spoken to Rafael before so also answered this question - offlist - and
              came up with a very similar one to you, even identically named property
              variable. I'd say it should be attached to a sprite rather than an extending
              frame script. That way, if any special frame script is needed, it can still be
              available.

              ---
              property pPauseState

              on beginSprite
              pPauseState = 0
              end

              on mouseUp me
              pPauseState = not(pPauseState)

              -- for sound in channel 1
              if pPauseState then
              sound(1).pause()
              else
              sound(1).play()
              end if
              end

              on exitFrame
              if pPauseState then go the frame
              end

              --

              regards
              Dean

              Director Lecturer / Consultant / Director Enthusiast
              http://www.fbe.unsw.edu.au/learning/director
              http://www.multimediacreative.com.au
              email: d.utian@unsw.edu.au


              • 4. Re: Pausing voiceover
                Level 7
                I do agree but my instinct is to do anything that controls the playback head
                in the frame script. It just feels logical in the overall scheme of things.
                But OOP would suggest to contain the work within the object that controls
                the work.


                potato potahto I suppose.


                --
                Craig Wollman
                Lingo Specialist
                Word of Mouth Productions
                212-928-9581

                www.wordofmouthpros.com
                "Dean Utian" <d.utian@unsw.edu.au> wrote in message
                news:46CAC036.CF66F3D2@unsw.edu.au...
                > "forum.macromedia.com" wrote:
                >
                >> You can put this on any sprite but I tend to put it in the frame script
                >> spanning the animation but ....
                >
                > Hi Craig,
                >
                > I have spoken to Rafael before so also answered this question - offlist -
                > and
                > came up with a very similar one to you, even identically named property
                > variable. I'd say it should be attached to a sprite rather than an
                > extending
                > frame script. That way, if any special frame script is needed, it can
                > still be
                > available.
                >
                > ---
                > property pPauseState
                >
                > on beginSprite
                > pPauseState = 0
                > end
                >
                > on mouseUp me
                > pPauseState = not(pPauseState)
                >
                > -- for sound in channel 1
                > if pPauseState then
                > sound(1).pause()
                > else
                > sound(1).play()
                > end if
                > end
                >
                > on exitFrame
                > if pPauseState then go the frame
                > end
                >
                > --
                >
                > regards
                > Dean
                >
                > Director Lecturer / Consultant / Director Enthusiast
                > http://www.fbe.unsw.edu.au/learning/director
                > http://www.multimediacreative.com.au
                > email: d.utian@unsw.edu.au
                >
                >