4

I need a high precision time method in microseconds rather than milliseconds for actionscript, unfortunately I couldn't find much help on the web.

I need such control in order to implement the usage of a fixed timestep in transitions as described in this article: http://gafferongames.com/game-physics/fix-your-timestep/, in order to solve my problem described in Optimizing transition/movement smoothness for a 2D flash game

Any suggestions?

Community
  • 1
  • 1
Tom
  • 8,536
  • 31
  • 133
  • 232
  • 1
    Flash's built-in timing functions only go to millisecond resolution, which should be enough. The techniques mentioned in the Gaffer on Games article don't require microsecond resolution. Have you already tried it with milliseconds and found it not smooth enough? – Selene Aug 17 '09 at 19:01
  • Unfortunately I didn't quite understand the states and integrating parts of that article, so I figured I'd first find a solution for as3 not having this time precision before I try. But maybe you are right and I don't need microseconds. – Tom Aug 17 '09 at 19:33

2 Answers2

7

This is not possible.

Tom
  • 8,536
  • 31
  • 133
  • 232
0

Although not insanely accurate, I believe this has way more time precision than relying on ENTER_FRAME.

public var t:Timer;
public var initialTime:int;

public function setup():void{
    t=new Timer(1000); //in miliseconds
    t.addEventListener(TimerEvent.TIMER, onTimerTick);
    t.start();
    initialTime=getTimer();
}

public function onTimerTick(e:TimerEvent):void{
    trace("elapsed:"+getTimer()-initialTime);
}
rodrigot
  • 132
  • 7