Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

actionscript 3 - Flash parallel programming

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...