A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: how can my clock slow down?

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389

    how can my clock slow down?

    Hi,

    I recently updated a clock I had made for my site thinking it was working right, but it always showed the local time when I meant it to show the time in my city, Barcelona.

    We're a couple of hours behind UCT.

    I'm attaching my fla because I really wouldn't find the issue. It works alright on preview but when I post it, it slows down, at least in my end...

    try https://webs.ono.com/jpdurba

    Attachment 74891

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    I would set an interval to run it. An interval will be accurate to within a second or so for hours. You can check the date every once in a while to be accurate.

    clearInterval(intTimer); // clear the interval if it's been set
    intTimer = setInterval(fUpdateTime,1000);

    function fUpdateTime(){
    // update clock by 1 second
    updateAfterEvent(); // this is very important, put it at end of function called by interval
    }

    I've had to make many clocks.

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    thank you so much, Moot, can't wait to fix it when I get home

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,145
    I use intervals for everything.

    Be sure to compare the interval's time to the user's time. I think the interval may run a little fast so you lower the interval time a little. It may be best at 998 or something instead of 1000.

  5. #5
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Will do so, thanks again. I bet it will be a good practice to use it for my local clock as well even if it doesn't have that much code to build the clock

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