A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: date and shared objects

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    354

    date and shared objects

    looking to find a good action script involving a shared object that holds the date after a button is clicked. This I can do just fine, but what I am looking for is a good way for the next time the movie is viewed to be able to determine the length of time that has expired since the button was last clicked and the current time. I DO know how to use the date object just having trouble trying to word correctly , in my head , the action script that would be needed(the math portion of it anyways). I guess I need some sort of if/then statement that would be like" if days elapsed > 3 and hours elapsed < 23 and seconds elapsed < 59 then movieclip.gotoAndPlay("whateva");

    pls help if possible.
    Thanks in advance.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    I was hoping part of the date object would tell you what day of the year it was (i.e. day 300 of 365), but apparently they don't have that.

    Your best bet might be to use Date.getTime() to get the number of milliseconds from January 1, 1970 and calculate how many milliseconds are in the amount of time you want to pass. Once you figure that out, it would simply be a matter of subtraction from the current time and the last time they clicked, and seeing whether it was greater than your magic time passed number.

  3. #3
    Senior Member
    Join Date
    Oct 2001
    Posts
    354

    so

    I used the date.getTime() thing and I think it worked I just hope I found the right conversion from days to miliseconds
    what i found was
    1 day= 86,400,000ms
    so i just did
    today=mydate.getTime()/86,400,000

    and that = 12422384880 and some change so I think this will work just fine so
    Thank you.

    PS if anyone finds this conversion to be wrong please leave a message to tell me the right ammount of miliseconds in a day.

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    354
    hmm must have spoken too soon it actually is changing the whole number everytime i look at it this isn't working quite yet

  5. #5
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    You aren't allowed to use swf footers.

    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    354
    I know be\ut we used to be able to and I never changed the code

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