6 Replies Latest reply on Nov 16, 2007 12:02 AM by wavesurfer

    Push Button doesn´t work

    wavesurfer Level 1
      I have a few simple navigation buttons (fwd, back, menu etc). The buttons have the Push Button behaviour attached to them (also tried my own simple mouse over behaviors to change the button sprites)

      Then I have a speaker in channel one.

      When I place a "Loop for x seconds" behaviour to a frame to wait for the sepaker to finish everything works fine. If I instead change to a wait for cue point in the tempo (which I will prefer), the Push Button behaviour (or alt. my own mouse over behavior) stops working!

      Any ideas would be highly appretiated!

      Thanks in advance!!
        • 1. Re: Push Button doesn´t work
          robdillon Most Valuable Participant
          This is the normal behavior for actions in the tempo channel. Any wait for... setting in the tempo channel will lock out Lingo while the tempo channel waits for something.
          • 2. Re: Push Button doesn´t work
            wavesurfer Level 1
            Thanks Rob!

            Ok, what strategy would you suggest instead?

            I am a newbie to Lingo so if you have a script I can use which waits for sound to end and the jumps to next marker I would be very happy!! My deadline is in a few days and this makes me pretty stressed ;-(
            • 3. Re: Push Button doesn?t work
              Level 7
              > Ok, what strategy would you suggest instead?

              Stay away from the tempo channel for anything other than tempo
              setting/changing.

              > I am a newbie to Lingo so if you have a script I can use which waits for sound
              > to end and the jumps to next marker I would be very happy!!

              Try the following in the frameScript channel:
              -- wait for sound in channel
              property myMonitorChannel

              on isOKToAttach(me, sType, sNum)
              return (sType = #script)
              end

              on getPropertyDescriptionList
              pdl = [:]
              props = [:]
              props[#comment] = "Sound channel to wait for:"
              props[#format] = #integer
              props[#default] = 1
              props[#range] = [#min: 1, #max: 8]
              pdl[#myMonitorChannel] = props
              return pdl
              end

              on exitFrame me
              if sound(myMonitorChannel).isBusy() then _movie.go(_movie.frame)
              end
              --

              If you don't have any score-based animation happening, this script can
              be adapted so that it allows you to select a sound to play when dropped
              on the frameScript channel and then plays the selected sound and waits
              for it to finish before continuing.
              • 4. Re: Push Button doesn?t work
                wavesurfer Level 1
                Sean, thank you!!! You made my day!! Works great!!

                Could I please ask for one more little addition? If I want a 1 or 2 second pause after the sound ends but before continuing, is that possible?

                Thanks again!
                • 5. Re: Push Button doesn?t work
                  Level 7
                  Try the following:
                  -- wait for sound in channel and pause before continuing
                  property myMonitorChannel
                  property myDelay

                  property myState
                  property myNavigateTime

                  on isOKToAttach(me, sType, sNum)
                  return (sType = #script)
                  end

                  on getPropertyDescriptionList
                  pdl = [:]

                  tChannel = [:]
                  tChannel[#comment] = "Sound channel to wait for:"
                  tChannel[#format] = #integer
                  tChannel[#default] = 1
                  tChannel[#range] = [#min: 1, #max: 8]
                  pdl[#myMonitorChannel] = tChannel

                  tDelay = [:]
                  tDelay[#comment] = "Milliseconds to wait after sound finishes:"
                  tDelay[#format] = #integer
                  tDelay[#default] = 1000
                  pdl[#myDelay] = tDelay

                  return pdl
                  end

                  on beginSprite me
                  myState = #playing
                  end

                  on exitFrame me
                  case myState of
                  #playing:
                  if ( sound(myMonitorChannel).isBusy() = 0 ) then
                  myState = #waiting
                  myNavigateTime = _system.milliseconds + myDelay
                  end if
                  #waiting:
                  if ( _system.milliseconds >= myNavigateTime ) then
                  _movie.go(_movie.frame + 1)
                  exit
                  end if
                  end case

                  _movie.go(_movie.frame)
                  end
                  • 6. Re: Push Button doesn?t work
                    wavesurfer Level 1
                    Thanks Sean, works just great!!