×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Count Down Timer

Count Down Timer

Count Down Timer

(OP)
I found the following code in this forum which displays a count down clock

-- 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


This obviously works fine but I need one which counts down from 15 seconds (rather than minutes) and have tried changing the code but can't seem to get it to work. Can anyone help?

RE: Count Down Timer

There's two separate things you need to change:

The references to '300' means 300 seconds (five minutes), so just change it to 15, where you see 300.

The second change is to change the text inserted into the member in the 'beginsprite' handler, where it says "5:00" you should change it to "0:15".

- Ben

RE: Count Down Timer

(OP)
Thought I tried this already but have done it again and it works. Thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close