开发者

Timers and threading in Flex 3 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 even开发者_运维技巧t-handler runs for minutes, so it is not the case that all ActionScript runs in one thread.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜