8 Replies Latest reply on Jan 25, 2007 4:55 AM by Dava

    Countdown Timer

    Dava Level 1
      Hi,

      I'm trying to buld a countdown timer into a simple game. I'm using the built in 'Countdown Timer' behaviour in Director MX. When the timer reaches zero I want to jump to a specific marker. I thought this would be quite simple but I can't figure it out! I've tried to put ' Go to marker "xxxxx" ' into ' Message to send after countdown' but this didnt work.

      Any help greatly appreciated!
        • 1. Re: Countdown Timer
          Level 7
          In the parameters for this behavior, select "movie scripts" in the
          "Where to send message" parameter. In the "Message to send after
          countdown" parameter put the name of a function to be called. This
          function needs to be in a movie script window.

          You could write something like this:

          on jumpToMarker
          go to marker "xxxxx"
          end

          and then specify "jumpToMarker" as the message to send.

          --
          Rob
          _______
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412-243-9119

          http://www.macromedia.com/software/trial/
          • 2. Re: Countdown Timer
            Dava Level 1
            Thanks rob, I tried this but got the following error after I created my movie script:

            Script error: Variable used before assigned value
            go to marker "finish"?

            • 3. Re: Countdown Timer
              Level 7
              Leave out the word marker:

              go to "finish"

              --
              Rob
              _______
              Rob Dillon
              Adobe Community Expert
              http://www.ddg-designs.com
              412-243-9119

              http://www.macromedia.com/software/trial/
              • 4. Re: Countdown Timer
                Dava Level 1
                Hmmm.. ok this got rid of the error message but it still doesnt seem to work. Nothing happens when the countdown gets to zero.

                I have this movie script in my cast:

                on jumpToMarker
                go to "finish"
                end

                And my Countdown Timer behaviour to send message:

                jumpToMarker
                to all movie scripts.

                I'm baffled!


                • 5. Re: Countdown Timer
                  Level 7
                  Hi Dava,

                  Is the function "jumpToMarker" in a movie script window? Use a put
                  statement to see if the function is being called.

                  on jumpToMarker
                  put "got to the function"
                  go to "finish"
                  end

                  You should see the string: "--got to the marker" in the message window
                  when the countdown finishes. That will tell you that the countdown
                  function is working correctly and that the jumpToMarker function was
                  found.



                  In article <ep4j49$4nv$1@forums.macromedia.com>,
                  "Dava" <webforumsuser@macromedia.com> wrote:

                  > Hmmm.. ok this got rid of the error message but it still doesnt seem to work.
                  > Nothing happens when the countdown gets to zero.
                  >
                  > I have this movie script in my cast:
                  >
                  > on jumpToMarker
                  > go to "finish"
                  > end
                  >
                  > And my Countdown Timer behaviour to send message:
                  >
                  > jumpToMarker
                  > to all movie scripts.
                  >
                  > I'm baffled!

                  --
                  Rob
                  _______
                  Rob Dillon
                  Adobe Community Expert
                  http://www.ddg-designs.com
                  412-243-9119

                  http://www.macromedia.com/software/trial/
                  • 6. Re: Countdown Timer
                    Dava Level 1
                    Hi Rob, thanks for that,

                    The function "jumpToMarker" is in a movie script window. I tested with the script you sent put nothing appeared in the message window. Just to check I've done this right...

                    I opened my cast, clicked on a blank cast member, opened the script window, changed it to movie script in the property inspector and entered:
                    on jumpToMarker
                    go to "finish"
                    end

                    In my Countdown Timer behaviour I have the 'Message to Send After Countown' as: jumpToMarker and send to All Movie Scripts.

                    Still no luck...


                    • 7. Re: Countdown Timer
                      Level 7
                      Dava wrote:

                      > Still no luck...

                      Hi Dava,

                      I found that 'go to' sometimes does not work well in some contexts. If you use the
                      countdown behavior, and send a message to 'all sprites' you could create a
                      behavior attached to a sprite in the same frame which could be:

                      on countDone
                      put "done1"
                      go to "dean"
                      put "done2"
                      end

                      Using countDone as your message, you'd see done1 and done2 appear in the Message
                      window but the 'go to' seems to be ignored. This makes no difference if it's set
                      as a movie script or a behavior.

                      Keep it as a begavior and try this:
                      property pMarker

                      on beginSprite
                      pMarker = ""
                      end

                      on countDone
                      pMarker = "dean"
                      end

                      on exitFrame
                      if pMarker <> "" then go pMarker
                      end

                      regards
                      Dean

                      Director Lecturer / Consultant
                      http://www.fbe.unsw.edu.au/learning/director
                      http://www.multimediacreative.com.au


                      • 8. Re: Countdown Timer
                        Dava Level 1
                        that worked!!

                        Thank you very much, this has been annoying me for days now trying to figure it out!

                        THANK YOU