Copy link to clipboard
Copied
I'm creating a AIR application, with the AIR 23 SDK, and need use the Worker object. With the adobe documentation I made a simple example to understand it. The code is below:
if(Worker.current.isPrimordial) {
var worker:Worker = WorkerDomain.current.createWorker(this.loaderInfo.bytes);
var mainToWorker:MessageChannel = Worker.current.createMessageChannel(worker);
var workerToMain:MessageChannel = worker.createMessageChannel(Worker.current);
worker.setSharedProperty("mtw", mainToWorker);
worker.setSharedProperty("wtm", workerToMain);
worker.start();
trace("[MAIN] Start worker.");
trace("[MAIN] Property one: "+worker.getSharedProperty("mtw"));
trace("[MAIN] Property two: "+worker.getSharedProperty("wtm"));
}
else {
trace("[WORKER] Status: "+Worker.current.state);
var mtw = Worker.current.getSharedProperty("mtw");
var wtm = Worker.current.getSharedProperty("wtm");
trace("[WORKER] Property one: "+mtw);
trace("[WORKER] Property two: "+wtm);
}
But the output traces are:
[MAIN] Start worker.
[MAIN] Property one: [object MessageChannel]
[MAIN] Property two: [object MessageChannel]
[WORKER] Status: running
[WORKER] Property one: undefined
[WORKER] Property two: undefined
When I change the AIR SDK to the 3.4, it works! The traces changes to:
[WORKER] Property one: [object MessageChannel]
[WORKER] Property two: [object MessageChannel]
Is it a bug? Can someone help me?