I have an EnterFrame event, and I want to know the exact time between calls, so I can animate objects more smoothly when the computer cannot create the desired frame rate.
To be more specific.
currentTime = getTimer(); diff = currentTime - prevTime; prevTime = currentTime;//update for next go around
EDIT
getTimer requires you to import the package: flash.utils.getTimer;
flash.utils.getTimer;
use getTimer ();
Timer - * ENTER_FRAME.
ENTER_FRAME
var timer:Timer = new Timer(500, 0); timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); private function timerHandler(event:TimerEvent):void { // do something // *EDIT* Thanks @Luke spotting this out (check comments) event.updateAfterEvent(); }
*) , , , script (- - ), . , , .
others say getTimer is the best way to go ... but I wanted to suggest something else: if you want to make time-based animations that are updated based on frames, you can also try some of the larger ActionScript animation libraries, like caurina Tweener ... they just do it out of the box and provide other great features ...
Greetz
back2dos
Source: https://habr.com/ru/post/1709439/More articles:Read audio track audio CD - c #get a standard way to encode pagination information into a calm url? - restnth problem with a prime number, you need to speed it up a bit - performanceПоиск составных чисел - c++TLS/SSL в .net - c#How to specify font height in different orientations? - fontsiphone sounds for more than five seconds - objective-cВопрос о Silverlight и как загружается приложение - silverlightTwo column pages with fields - htmlPremier Numbers Program - c ++All Articles