A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Question about getTimer();

  1. #1
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167

    Question about getTimer();

    Hey everyone,

    Ok so I have this timer that counts the seconds that go by:
    time = Math.floor(getTimer()/1000);

    And basically Im using this to check how many seconds go by before something happens. I do this by:
    if (time/orangeRandom == 1) {

    So I check if time divided by a number equals 1. If so, then I know that a certain amount of seconds have gone by and I can move on to do something in the IF statment.

    But my problem then comes later on , I need to know if its possible to reset the timer back to 0.

    It seems that the function getTimer(); is always constantly going as soon as you call it I cant figure out how to start it back at 0. I probably could work around it, but this is the easiest way I can see, fastest and also would contain the least amount of code.

    If someone could give me a boost , it would be appreciated

  2. #2
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    the getTimer() always gives you the time in millisecons since the flash started.

    If you need a time difference, you would need to remember some start time
    and check that against the current time...

    starttime = getTimer();
    timedif = getTimer()-starttime;

    is such an approach
    My letters on the F1 key have faded, how are yours today?

  3. #3
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Hey McUsher,

    I think thats exactly what I need. Im going to give it a try.

    Many thanks

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