Flash parallel programming

这一生的挚爱 提交于 2019-12-17 19:54:39

问题


Since Flash doesn't support thread, how does it manage to deal with multiple animations ? Is it only internally that Flash uses threads but which are not accessible to the programmer ?

How on the principle can you implement parallel tasks in flash like what's described here: http://books.google.fr/books?id=1OJ8EhvuPXAC&pg=PA352&lpg=PA352&dq=FLASH+PARALLEL+TASK&source=bl&ots=iTQIolYXCy&sig=edGCy1YYAZYJfxAMhrfUBkiggwo&hl=en&ei=94WgTfGWCMmxhAfgkNGQBQ&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBQQ6AEwAA#v=onepage&q=FLASH%20PARALLEL%20TASK&f=false


回答1:


Threading is not supported in the actionscript 3 language. However you can achieve a type of pseudo-threading for many common or process-intensive applications. See the following articles for theory + demos and source:

http://www.senocular.com/flash/tutorials/asyncoperations/

http://blog.claudiu-ursica.ro/tag/pseudothreads/

As for weather or not the flash VM is multi-threaded, the answer is, sort-of. Basically everything you do in actionscript 3 is executed in a single thread EXCEPT for pixel bender filters, which are processed in their own thread. Also, for the next major release of flash player, the GPU is exposed so things can/are pushed to the GPU as well so how that factors in, not sure. Anyway below are some references:

http://en.wikipedia.org/wiki/Tamarin_(JavaScript_engine)

http://www.mozilla.org/projects/tamarin/faq.html

Notice in the next link, this person is assigned specifically to a project in development to bring multithreading to the flash VM.

http://www.adobe.com/technology/people/sanfrancisco/wilkinson.html

***Update***

In regard to my statement about pixel bender running in it's own thread, people use pixel bender for number crunching because of this very reason:

http://www.adobe.com/devnet/flex/articles/flashbuilder4_pixelbender.html

Forgot all about it, figured it needed to be added here.



来源:https://stackoverflow.com/questions/5606195/flash-parallel-programming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!