Search code examples
actionscript-3flashdatedatetimeauto-update

as3 date should increase itself


I have figured out that once I set my AS3 date to server datetime, it remains the same for the whole life of it.

It was suppose to be updating itself e.g.

I set: 
2012/10/23 5:20

and after 2 hour(keep running SWF) it should be

2012/10/23 7:20

but it remains:

2012/10/23 5:20

Which is against my requirement, I am searching for a good solution to keep my server time up to date without any interference of client timestamps


Solution

  • Thanks @Florent, @Sohel Khalifa, I have finally resolved the problem. I tried this:

    var clock:Date = new Date('2012/10/23 5:20:00');
    var tim:Timer = new Timer(1000);
    
    tim.addEventListener(TimerEvent.TIMER,function(){
        clock.time = clock.time + 1000;
        trace(clock.getMinutes()+":"+clock.getSeconds());
    });