views:

142

answers:

1

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.

+1  A: 

this answer of mine deals with the subject: http://stackoverflow.com/questions/1102839/as3-timers-vs-enter-frame-performance/1104924#1104924

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

back2dos