How to determine the actual time interval the user sees between two successive images
I would like to implement an inspection time task using Actionscript. The idea is to dynamically change the time interval between masked and unmasked images based on user responses. The "inspection time" is defined as the interval at which the user achieves certain accuracy. There are various factors affecting the accuracy of that interval: monitor refresh rate, flash vm frame rate, Timer event accuracy, render time. Anything else? How do I determine the actual inverval the user sees? High accuracy is required, since typical performance is from 20 to 80 msec on 开发者_如何学编程that task. I assume the limiting factor is the monitor refresh rate. If it's 60Hz, I would only be able to increment by 16.7msec. Any way around this limitation? If I use a higher frame rate, would the player still sync it to 60Hz?
There's an upper limit to the framerate achievable by the Flash player. While you can technically set the value higher than 60fps, I don't believe that the screen will ever refresh more quickly than this if the user has a modern version of Flash Player installed. Also, it doesn't really matter what framerate you set, as it's a suggestion that the player should do its very best to refresh at that rate... and it will do so if it's at all possible! However, there are a number of factors that might make it impossible for the player to actually keep up to that framerate.
A complex scene with many different movieclips, multiply nested.
Overuse of masks
Repeatedly applying filters
Particularly complex or inefficient code implemented in an ENTER_FRAME or TIMER event handler (or many of them)
A complex object graph
Wastefully instantiating and disposing of objects, thus forcing garbage collection (this causes a noticable hiccup at very high framerates).
It should also be noted that you cannot truly rely on the delta time between updates, either ENTER_FRAME or TIMER to be 100% consistent even in the best of circumstances.
Hopefully this helps.
精彩评论