1 Reply Latest reply on Oct 14, 2014 5:31 PM by Sean_Wilson

    Wait or hold

    H.F. Duijndam Level 1

      Hi there


      I am using this code, and i want the movie to hold for 2 sec before it goes further

      who can help me with this?






      on mouseDown

        cursor 4

        put empty into field "FieldCh36"

        Put field "field 19" into field "FieldCh36"

        Put empty into field "field 19"

        cursor 0

        if field "FieldCh36" = "vogelnestjestang" then

          put empty into field "field 19"

          sprite(20).visible = true

          -- Here i want to wait voor 2 sec how can i do this?

          go next

        end if


        if field "FieldCh36" <> "vogelnestjestang" then

          put field "FieldCh36" into field "field 19"

          sprite(21).visible = true

          put empty into field "FieldCh36"

        end if




        • 1. Re: Wait or hold
          Sean_Wilson Adobe Community Professional

          You have a couple of options.


          The quick-and-dirty (and not recommended) solution is to tie up your processor doing nothing for 2 seconds:

          tMillis = the milliseconds + 2000

          repeat while the milliseconds < tMillis


          end repeat


          A better solution is to use a timeout object and a callback handler (I can't tell if the code you posted is in a behavior script attached to a sprite or in a movie script):

          -- yadda yadda

          t = timeout().new("goNext", 2000, #mNavigate, 0)



          -- add this new handler to a movie script

          on mNavigate padParameter, aTimeout

            if ilk(aTimeout, #timeout) then aTimeout.forget()

            go next