• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Worker don't receive MessageChannel object in getSharedProperty()

Community Beginner ,
Nov 07, 2016 Nov 07, 2016

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?

TOPICS
Air beta

Views

311

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines