Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count down from server time

Status
Not open for further replies.

solex

Programmer
Feb 28, 2003
91
0
0
GB
Hello,

Im trying to code a script to produce a visual countdown to a spesific time and preform an action if the time reaches zero or if it has allready passed.

Also the current server epoch is taken from a php script using loadvars when the flash movie is loaded, this is the part im getting confused with, getting it to count down to server time rather than local time...

any help would be great :)

Thanx in advance

solex
 
hello.

I'm not sure how this will help me?

solex
 
If you create a Date object with server date, you can calculate the difference between that and the local date. Then you can use this info to display the countdown to specific server date.

But may be you're talking about something else.


Kenneth Kawamoto
 
I want to effectivly sync the server time to the time the flash uses rather than using the local time that could be wrong, does that make sense?

solex
 
but if i referance the date 5 seconds after i have set it will it give me the server time + 5 seconds, this is what i need.
 
No, the date in Date object is fixed at the time of creation, unless you modify it with Date.setDate() etc.

Say you create a Date object "var myDate:Date", 5 minutes later the value of myDate will be still the same as when it is created.

Kenneth Kawamoto
 
ok that's not what I need then. I need to be able to refrance a date object that counts on like a normal clock but is set running at a time set by me...
 
You have to create such a clock yourself. Just work out the time difference between local Date and server Date, then use that to display the time.

You may also want to have a look at setInterval() and setTimeout().

Either way, 5 seconds in Flash means local 5 seconds, which will be different from server 5 seconds, strictly speaking. Do you see what I'm saying...?


Kenneth Kawamoto
 
yes I do. I'm now looking at the section of the object where you can look at the umt rather than local time. this may work for me. other wise I will use the method you said. thank you

solex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top