A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Timer code help needed

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    Timer code help needed

    Hello everyone,

    I am trying to make a timer that will hold on the current frame for seconds (which works) but i'd like to be able to enter half seconds or decimal places as well. so 2.5 sec, not just 2 for example.

    Can anyone help? thanks!


    // working code so far
    displayTime = 3;
    countDown = function (message) {
    displayTime--;
    if (displayTime == 0) {
    clearInterval(timer);
    play();
    }
    };
    timer = setInterval(countDown, 1000);

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ??? you decide that in miliseconds.. so in your code above..you have 1000 mili-seconds.. (which is 1 second)...you can put 1500 which would be 1.5 seconds.

  3. #3
    Senior Member
    Join Date
    May 2003
    Posts
    160
    ya thats what i thought, i want to be able to put the seconds in like 2.5, not change the milliseconds.

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    ?? are you joking? I dont see a difference? add a couple of zeros.

    anyways..thats the way the function is set up.

    if its THAT big fo a problem..make a function to parse the string how you want it to work. strip out the (decimal) and add/padd with two 00's

  5. #5
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    whispers, yer sig is awesome

  6. #6
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    thanks..I try to add ones that either most people ask about..and some ones that sme may NOT know about.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center