I had intended my previous post to be the final in the AS3 Workers series, but Adobe has made some last-minute changes in the 11.4 Player that I need to address.
Specifically, they have pushed back support for ByteArray.shareable to Player 11.5 / AIR 3.5 citing last minute bug reports. This means that you must manually share the ByteArray, and it also means that 2 of my demo’s have broken!
The only difference is that instead of just sharing the ByteArray in our Init , and then relying on it to be shared, we must manually share it each time it gets changed.
There’s 2 ways to do this:
- worker.setSharedProperty(“byteArray”, byteArray);
Beyond that all code can stay the same. We can retain our fast serialization method of packing everything into a ByteArray, as it’s still the quickest way to transfer data.
The downside here now is that the memory must actually be transferred from Worker to Main Thread, this will incur some performance penalties, but I’m not sure to what extent, or in what Thread the hit will occur.
Below is the updated source files for all the examples:
I’ve also updated the respective articles with new Examples and Source Code.