AS3使用Workers [英] AS3 using Workers
问题描述
- IDE:FLASH CS6 Professional
- SDK:AIR 18 for Android
我正在尝试为我的应用程序使用 Workers
。
问题是,它应该不会起作用。
I'm trying to use Workers
for my app.
The problem is, it doesn't work that it suppose to be.
public class Main extends Sprite {
private var worker:Worker;
public function Main() {
var ba:ByteArray = this.loaderInfo.bytes;
if(Worker.current.isPrimordial){
worker = WorkerDomain.current.createWorker(ba);
worker.start();
trace("Created Main");
}else{
trace("Created Worker");
}
}
}
应输出
Created Main
Created Worker
但我只能得到
[SWF] Test.swf - 2831 bytes after decompression
Created Main
[UnloadSWF] Test.swf
Test Movie terminated.
编辑:
好吧,我试图发布应用程序并运行它。它的工作原理应该是这样。但是,当我尝试使用 Adobe Debug Launcher
来运行它时,为什么它不起作用?
Ok i tried to publish the app and ran it. It works like it should be. But why doesn't it work when i try to ran it with Adobe Debug Launcher
?
这就是它的含义看起来像在Android调试启动器(ADL)上
This is what it looks like on Android Debug Launcher (ADL)
这就是发布时的样子。
编辑2:
与 Flash Professional CC 2015
进行了尝试。升级到 AIR SDK 19.0.0.213
。
结果还是一样。多么痛苦的Adobe。
Tried it with Flash Professional CC 2015
. Upgraded to AIR SDK 19.0.0.213
.
Still the same result. What a pain Adobe.
推荐答案
目前,仅在桌面平台上支持worker。此 Adobe开发人员指南页面特别提到了 对于台式机平台。
At the moment, workers are only supported on desktop platform. This Adobe developer's guide page specifically mentions "for desktop platforms".
同时,还有一个 AS3-Worker-Compat 库,使您可以与Workers一起编写代码,这些代码在不支持Workers的环境中仍然可以正常工作(当然,在这种情况下,您的代码将在单线程模式下运行。)
Meanwhile, there is an AS3-Worker-Compat library by Jeff Ward that enables you to write code with Workers that will still work correctly in an environment that doesn't support Workers (of course, in this case your code will run in single-threaded mode).
我认为许多人正在等待Adobe为移动实现工人,希望将来会出现。
I think many people are waiting for Adobe to implement workers for mobile, hopefully it will come in the future.
这篇关于AS3使用Workers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!