Quantcast
Channel: Adobe Community : Popular Discussions - Using Flash Builder
Viewing all articles
Browse latest Browse all 70427

Workers in AIR for desktop

$
0
0

My question here specific to AIR apps for desktop, not for the web. I have Flex 4.6 and AIR 3.5. I've beed Googling for days with no joy.

 

There are no code errors but does anyone know where and how to initialize workers in the main mxml file or hat appliaction handler should be used to get the worker thread to set the mainToWorker and workerToMain MessageChannel's, as there is no class initializer like there is in web flex projects.

 

if(Worker.current.isPrimordial){

                                                  worker = WorkerDomain.current.createWorker(this.loaderInfo.bytes);

                                                  mainToWorker = Worker.current.createMessageChannel(worker);

                                                  workerToMain = worker.createMessageChannel(Worker.current);

                                                  worker.setSharedProperty("mainToWorker", mainToWorker);

                                                  worker.setSharedProperty("workerToMain", workerToMain);

 

                                                  workerToMain.addEventListener(Event.CHANNEL_ MESSAGE, onWorkerToMain);

                                                  worker.start();

 

                                        }else{

     // if in worker thread

                                                  mainToWorker = Worker.current.getSharedProperty("mainToWorker");

                                                  workerToMain = Worker.current.getSharedProperty("workerToMain");

                                                  mainToWorker.addEventListener(Event.CHANNEL_ MESSAGE, onMainToWorker);

                                        }

 

Cheers,

Nige


Viewing all articles
Browse latest Browse all 70427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>