Flash 中的计时精度

发布于 2024-09-19 16:18:22 字数 557 浏览 3 评论 0原文

有谁知道闪存定时的准确度及其识别客户端显示器刷新率的能力?我需要能够以高达 10 毫秒的响应时间精度计算持续时间。另外,如果它关闭,是否有办法根据显示器刷新率和操作来校准响应,以确保该值尽可能接近精确?任何信息都会很棒!更好的是现有基准测试的一些例子。

更新

我发现这篇文章很有帮助,但想看看其他人是否有关于该主题的其他内容可以添加。

AS3: getTimer() 方法的准确度如何和 Timer 类?

http:// /www.kaourantin.net/2006/05/frame-rates-in-flash-player.html

Does anyone know how accurate flash timing is and its ability to identify the client monitor's refresh rate? I need to be able to calculate time durations with up to 10 milliseconds accuracy of response time. Also if it is off, is there a way to possibly calibrate the response based on monitor refresh rate and action to make sure the value is as close to precise as possible? Any info would be great! Even better would be some examples of existing benchmark test.

Update:

I've found this post which is helpful but wanted to see if anyone else has anything else to add on the subject.

AS3: How accurate are the getTimer() method and the Timer class?

http://www.kaourantin.net/2006/05/frame-rates-in-flash-player.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弥枳 2024-09-26 16:18:22

无法检测到它,并且 Flash Player 不使用垂直同步,因此计算更新时间没有多大用处。

这完全取决于您想用它做什么。如果您只是在屏幕上计时,请使用 getTimer,因为它精确到 1 毫秒——您绝对不需要知道显示器的刷新率。

此外,Timer 类对于调用来说并不可靠,因此要么推出自己的计时器类,要么在 onEnterFrames 上使用 getTimer(进行屏幕更新的最准确方法)。

No way to detect it, and the Flash Player doesn't use vsync so calculating update times wouldn't be of much use.

It all depends on what you want to use it for. If you're just timing something on screen, use getTimer as it's accurate to 1ms -- you absolutely don't need to know the monitor refresh rate for that.

Also, the Timer class is unreliable for calls so either roll your own timer class, or use getTimer on onEnterFrames (most accurate way to do screen updates).

極樂鬼 2024-09-26 16:18:22

即使在 AIR 中,您也无法从 Flash 获得显示器刷新率。是的,帧可以在不同的时间渲染(特别是在重负载下)。 AFAIK,准确时间的最佳来源是 getTimer()。 ENTER_FRAME 中基于 getTimer() 的动画很流畅(前提是帧速率足够高),尽管帧速率可能会有所不同。

编辑:您的代码有机会在帧更改之间执行,因此将帧速率设置为高并保持负载较小。这样您就有更多机会及时做出回应。我相信 getTimer() 的精度可达 1 毫秒,但检查起来有点困难。运行程序几个小时,然后比较 getTimer() 和实际经过的时间?..

You don't get monitor refresh rate from Flash, even in AIR. Yes, frames can render in different time (especially under heavy load). AFAIK, your best source of accurate time is getTimer(). Animation based on getTimer() in ENTER_FRAME is smooth (provided frame rate is high enough), although frame rate may vary.

Edit: Your code has chance to execute between frame changes, so set frame rate high and keep load small. This way you get more chances in time to respond. I believe the accuracy of getTimer() is up to 1 ms, but it is a little hard to check. Run program for few hours, then compare getTimer() and actual time passed?..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文