How can I set actionscript 3 timer to read time from server, GMT or UTC rather than local machine?

I am creating a timer to countdown to New Years at Times Square. I found this great tutorial to create a timer but it reads time form the end user's computer so if they are in a different time zone it will give the wrong time.

http://schoolofflash.com/2008/04/tutorial-creating-a-timer-in-actionscript-3/

Is there a way to tell Flash to read from the server's clock or GMT or UTC and then adjust?
stan4dAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rascalpantsCommented:
you need to pass the year, month, and day into the SWF using FlashVars or an appended query string...


here is what i put in my first frame...


// LoaderInfo example code
var loaderObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

var theYear:int;
var theMonth:int;
var theDay:int;

     
if ( loaderObj.endyear )
{
  theYear = loaderObj.endyear;
  theMonth = loaderObj.endmonth;
  theDay = loaderObj.endday;
}
else
{
  // does not exist, so set manually
  theYear = 2010;
  theMonth = 0;
  theDay = 1;
}


var endDate:Date = new Date( theYear, theMonth, theDay );



then you just need to pass in the three variables...  endyear, endmonth, endday


rp / ZA
0
rascalpantsCommented:
btw... I am using Actionscript 3.0

if you need AS 2.0 then instead of using the LoaderInfo class, you can just reference the passed in variable like this...

_root.endyear, _root.endmonth, _root.endday


so you can use this...


var endDate:Date = new Date( _root.endyear, _root.endmonth, _root.endday );


rp / ZA
0
stan4dAuthor Commented:
Thanks for the quick reply.

That works to control the end date, but what I'm looking to do is control the timezone that the countdown is relative to. Right now it is getting the time from my computer regardless of what time zone I view it. If I'm not set to New York time on my computer then my countdown is wrong.

In this example I'm focused on 12:00 New York time. So no matter where you view it from I need to show the New York countdown. So the timer will actually reach 00:00 at 12:00am  in New York, 9:00pm in California, 6:00pm in Hawaii, etc...

BTW - need for AS3 - thanks.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

rascalpantsCommented:

well if the server is in NY, then just pass that in using the method above... if not, you can use... Date.getTimezoneOffset() or use getUTCHours + 5 hours

this should give you what you want...


rp / za
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stan4dAuthor Commented:
Sorry - I've been trying to make it work for a while - no success. Is it possible you could please provide a sample showing implenmented getUTCHours? There's got to be something I'm missing. Many thx.
0
stan4dAuthor Commented:
Got it working - thanks for your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.