A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [help] getTimer function

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    [help] getTimer function

    I have been trying to create a timer that counts down from 5 to 0 and then loops back to 5.

    I have been messing around with getTimer, but i cant find a function to reset it... I tryed all my idea's but nothing worked.

    Is there a way to acuratly setup a timer. Its for a game which might slow down on slower computer so i need it to be acurate and not depend on the frame rate other wise if it dose slow done some people will get an atvantage.

    Are there any help files i should be looking at or tutorials?
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    im guessing you want the timer to loop becasue you want ot refresh something every 5 secs?
    i would use setInterval instead:
    Code:
    function myFunction(){
     //whatever code
    }
    var myInterval = setInterval(myFunction, 5000)
    this will execute the function every 5000 ms (5 secs)

    HTH,

    zlatan
    New sig soon

  3. #3
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    Thats exacltly what i want but i would prefer it to count down but its not crucial.
    I am going to display the current time in a dynamic text box so i need to be able to monitor it, I cant do that with set interval can i?

    What i was thinking was i have a varible called timer, i use getTimer and every second the varible timer decreases by 1. Once it reaches -1 it resets to 5 again...

    Is this a possable solution, I have it all worked out except the part of figureing out how to determan 1 second has passed...

    Thanks for your help
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

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