http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Worker.html
我之前一直纠结为什么air的桌面应用里加入多线程没有任何反应。今日看了下官方文档中的例子,文档里说的好好的在air的桌面应用里是可以有多线程的。
Note: The use of workers for concurrency is only supported in Flash Player (except with wmode "transparent" or "opaque") and in AIR on desktop platforms. Concurrency is not supported on mobile AIR platforms. You can use the static isSupported property to check whether concurrency is supported before attempting to use it.
后来发现也许是我之前的方式有问题。
官方中的例子是通过Embed将一个背景线程的swf引入到代码中,然后通过读取他的ByteArray来工作的。
似乎在air里无法通过主stage的loaderInfo.bytes来进行线程的创建。(此句话是我的猜测)。
根据文档中的例子,整合了个air版和fp版的多线程例子。希望对大家有用。
在air里可以正常运行。 我还没有细看代码。在最近几天我会总结一份相关东西发上来的。敬请关注。
下面是较新的一篇关于air桌面应用多线程的总结
http://bbs.9ria.com/thread-145847-1-1.html