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

Trouble creating a background worker

Participant ,
Jul 23, 2015 Jul 23, 2015

Hi,

I'm trying to set up a simple example of workers following the Adobe examples but when I try to create an instance of a worker it always returns null.

private var worker:Worker;

var workerLoader:URLLoader = new URLLoader();

workerLoader.dataFormat = URLLoaderDataFormat.BINARY;

workerLoader.addEventListener(Event.COMPLETE, loadComplete);

workerLoader.load(new URLRequest("BackWorker.swf"));

private function loadComplete(event:Event):void  {

var workerBytes:ByteArray = event.target.data as ByteArray;

trace(workerBytes.length); //this traces out 154876 so I know my worker swf is being loaded.

worker = WorkerDomain.current.createWorker(workerBytes);

trace(worker); //this traces null

  }

Would anyone have any ideas why the worker isn't being instantiated?

Thanks,

Mark

TOPICS
ActionScript
234
Translate
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
no replies

Have something to add?

Join the conversation