如何打造一款精准、匹配实时的天文台表?
我正在开发一个教育软件,主要使用 Flash AS3 开发,我们有一个计时器,可以通过不同的用户显示不同的值。 示例:两个用户同时启动计时器,但在使用几分钟后,他们的值不同。
当前的实现使用Timer类,导致这种情况发生,显然是由于每台计算机的平均速度不同。
我心里已经有了一个想法,但我想得到一些理论上的建议。 提前致谢。
I'm working in an educational software, mostly developed using Flash AS3, and we have a chronometer which shows different values through different users.
Example: Two users starting the chronometer at same time, but along some minutes of usage, they have different values.
The current implementation uses Timer class, causing this to happen, obviously due the different average speed of each computer.
I already have an idea in mind, but I would like to have some theoretical suggestions.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Timer 类不是很准确。来自文档: http://help.adobe .com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html
如果您正在查找自应用程序启动以来的相对时间,请使用 flash.utils.getTimer()。 http://help .adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#getTimer%28%29
如果您想做更复杂的计时,可以使用日期类。 http://help.adobe.com/en_US/FlashPlatform/reference /actionscript/3/Date.html
The Timer class is not very accurate. From the docs: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html
If you're looking for a relative time since the start of your application, use flash.utils.getTimer(). http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/package.html#getTimer%28%29
If you want to do more sophisticated timing, you can use the Date class. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html