2 Replies Latest reply on Jan 14, 2009 2:07 PM by JohnGiannakos

    AS3 Timer class doesn't work after 2148300000 milliseconds

    JohnGiannakos
      I'm using the Timer class to countdown a user selected amount of time.

      If the total number of milliseconds the user selects is around 2,148,300,000 (roughly 25 days) or greater, the Timer fires the complete event immediately. 2,145,600,000 and less works how it should. Not sure what else to describe here.

      This is a problem in Adobe AIR 1.5 and Flex 3.2, flex code to reproduce shown below.
        • 1. Re: AS3 Timer class doesn't work after 2148300000 milliseconds
          rtalton Level 4
          Is there really a Flex application someone would run for 25 days straight? Just kidding.
          I did a little checking and found the threshold value at which the timer fires immediately is actually 2,147,483,648.
          Coincidentally, this is the maximum value of the int data type, plus 1 (2,147,483,647 + 1).

          The docs say that the Timer Constructor is looking for a Number data type (values between positive and negative 9,007,199,254,740,992), but obviously something else is happening here. I wonder if the Timer can only handle an int data type?

          As a workaround, you could create a second timer which is called by the first timer's timer event after 2,147,483,647 ms. The second timer could continue from 2,147,483,648 to its limit.
          • 2. AS3 Timer class doesn't work after 2148300000 milliseconds
            JohnGiannakos Level 1
            Thanks for the quick reply rtalton, makes sense. Guess I'll be writing the extended timer class.

            Does anybody at Adobe have any insight regarding the documentation? Is it just a typo?