Flex 3 ActionScript 中的计时器和线程

发布于 2024-09-04 18:25:26 字数 243 浏览 3 评论 0原文

Flex 3 ActionScript 不支持程序员线程。

但是flash.utils.Timer有什么作用呢?它是在单独的线程还是主循环中运行?如果是后者,是否意味着如果主循环处于长时间运行的操作中,计时器可能不会被调用?

更一般地说,您能告诉我有关 ActionScript 中运行的线程的哪些信息?如果事件处理程序运行几分钟,我的每分钟一次计时器就会被调用,因此并非所有 ActionScript 在一个线程中运行。

Flex 3 ActionScript does not support programmer threads.

But what does flash.utils.Timer do? Does it run in a separate thread or the main loop? If the latter, does that mean that the Timer might not be called if the main loop is in a long-running action?

More generally, what can you tell me about threads running in ActionScript? My once-a-minute Timer is called if an event-handler runs for minutes, so it is not the case that all ActionScript runs in one thread.

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

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

发布评论

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

评论(1

冬天旳寂寞 2024-09-11 18:25:26

我的这个答案涉及这个主题:AS3计时器与ENTER_FRAME性能< /a>

现在我的回答引发了一场关于计时器是否实际上是单独线程的讨论。可以肯定的一件事是,ActionScript 字节码仅在主线程中执行。同步执行是完全线性的。只有当一个事件被完全处理时,控制权才会交还给主循环,以处理其他事件,因此当主线程繁忙时,不会发生其他事情。

最后,这意味着计时器不会在应该调用的时候被调用,或者根本不会被调用。根据不同的事件,它们要么堆叠起来,要么简单地丢弃。

问候
后退2dos

this answer of mine deals with the subject: AS3 Timers vs. ENTER_FRAME performance

Now my answer lead to a discussion whether or not Timers actually are seperate threads. One thing, that is for certain is, that the ActionScript Bytecode is executed only in the main thread. Synchronous execution is completely linear. Only when one event is fully processed, controll is given back to the main loop, to process other events, so while the main thread is busy, nothing else happens.

In the end, it means the timer will not be called whan it should or maybe not at all. Depending on different events, they either stack up or are simply dropped.

greetz
back2dos

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