Another Countdown Timer Question

March 10th, 2010 by jane
  • I found the countdown timer on the site and it is the best that I have found. However, I need a very simple countdown timer that I can set the time in the Flash file. Have the counter start when the movie starts.
    All I need is minutes and seconds to display.
    This is for timed learning modules.
    When the time is up, I would like the movie to proceed to the last frame.

    I have found many countdown timer examples online but they typically require a button to start the countdown and an entry of the staring time or they countdown to a date that is entered. These are way too complex for my needs.
    I need the timer function to be invisible to the user. Just display how much time is left.

    I am new to Flash, and have tried to modify existing codes with terrible results.
    Help! cried the newbie.


  • You're not asking for a server-based countdown timer that everyone sees world-wide are you? Like one before a site launch showing how many weeks/days/hours left? You just want a small flash timer that resets everytime you open the movie?

    Visually, it'll get confusing because of how analog clocks work with the 0 in front of numbers less than 10 such as 5:09...so I'm not sure how you'd place a timer so the user can see it, but it can be done visually by seconds rather than mins:seconds with this code:

    // Minutes of timer.
    var minutes:Number = 5;
    // Seconds of timer.
    var seconds:Number = 30;
    var totalSeconds:Number = (minutes*60)+seconds;
    var runCountdown = setInterval(countdownTimer, 1000);
    function countdownTimer() {
    if (totalSeconds>0) {
    totalSeconds--;
    }
    }
    onEnterFrame = function () {
    if (totalSeconds<=0) {
    clearInterval(runCountdown);
    trace("Time's Up!");
    // Execute code to progress to last frame here.
    delete onEnterFrame;
    }
    };This code runs for 5mins 30 seconds. Make sure you fill in the minutes/seconds variables & flash should do the rest for you. Also, fill in the code that runs the movie to the end once the time is up.

    (oh & thank you anogar, Ive found my first use for using your help lol)







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Another Countdown Timer Question , Please add it free.

    Posted in enart.gcgx.com  |  edit

    Bulgaria-Italy: How many miles will Berbatov walk today? Xbox 360 fans ?????????????