1 Reply Latest reply on Sep 27, 2006 2:39 AM by Newsgroup_User

    Count Down Timer

    jake_pomme Level 1
      I found the following code for displaying a counter however, I need a counter that counts down from 15 seconds (this 1 is for minutes). I have tried changing the code but can't seem to get it right. Can anyone help?

      -- behaviour script attched to a text sprite
      on beginSprite me
      sprite(me.spriteNum).member.text = "5:00"
      startTimer()
      end beginSprite

      on enterFrame me
      tSecElapsed = (the timer)/60
      if tSecElapsed < 300 then
      tTime = 300 - tSecElapsed
      tSec = tTime mod 60
      if tSec < 10 then
      tSec = "0" & tSec
      end if
      tMin = tTime/60
      sprite(me.spriteNum).member.text = tMin & ":" & tSec
      else
      sprite(me.spriteNum).member.text = "0:00"
      end if
      end enterFrame
        • 1. Re: Count Down Timer
          Level 7
          You can't??

          Just change the two appearances of 300 to 15.

          300 seconds is, guess what, 5 minutes.

          Also, to make it cleaner you should only put 0:00 into the text member if
          it's not already 0:00. That way it's not constantly updating the text
          member for no reason.

          --
          Craig Wollman
          Word of Mouth Productions

          phone 212 928 9581
          fax 212 928 9582
          159-00 Riverside Drive West #5H-70
          NY, NY 10032
          www.wordofmouthpros.com


          "jake pomme" <webforumsuser@macromedia.com> wrote in message
          news:efdd84$7ru$1@forums.macromedia.com...
          >I found the following code for displaying a counter however, I need a
          >counter
          > that counts down from 15 seconds (this 1 is for minutes). I have tried
          > changing
          > the code but can't seem to get it right. Can anyone help?
          >
          > -- behaviour script attched to a text sprite
          > on beginSprite me
          > sprite(me.spriteNum).member.text = "5:00"
          > startTimer()
          > end beginSprite
          >
          > on enterFrame me
          > tSecElapsed = (the timer)/60
          > if tSecElapsed < 300 then
          > tTime = 300 - tSecElapsed
          > tSec = tTime mod 60
          > if tSec < 10 then
          > tSec = "0" & tSec
          > end if
          > tMin = tTime/60
          > sprite(me.spriteNum).member.text = tMin & ":" & tSec
          > else
          > sprite(me.spriteNum).member.text = "0:00"
          > end if
          > end enterFrame
          >
          >