Since Flash doesn’t support multithread how do you that in actionscript 3 ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The short answer is – by adding an event listener to do it asynchronously.
The long answer is that it’s quite simple – if you’ve done it once, you’ve done it a million times:
Basically the ActionScript Virtual Machine runs in a ‘Dispatch Events, Process Events, Render Graphics’ loop; each frame, events are given a timeslice, and each event is ‘essentially’ run as a thread (would be) in a uniprocessor system.
While it’s true that ActionScript isn’t multi-threaded, it does rely on a very sexy event-driven architecture that in many cases is a better alternative to threads (check out this paper here: http://www.stanford.edu/class/cs240/readings/threads-bad-usenix96.pdf).
That being said, hopefully future versions of the AVM will have explicit support for multiple threads, if only to better advantage near-ubiquitous multi-processor systems.