actionscript 3 - ByteArray.clear() not working for shared ByteArrays? -
it appears bytearray.clear() doesn't when share bytearray worker. take code example:
package { import flash.display.sprite; import flash.system.worker; import flash.system.workerdomain; import flash.utils.bytearray; public class main extends sprite { private var _worker:worker; public function main():void { if (worker.current.isprimordial) { initmain(); } else { initworker(); } } private function initmain():void { _worker = workerdomain.current.createworker(loaderinfo.bytes, true); var bytes:bytearray = new bytearray(); bytes.writeunsignedint(12836439); bytes.shareable = true; _worker.setsharedproperty("bytes", bytes); bytes.clear(); trace(bytes.length); } private function initworker():void { //worker stuff go here } } } this traces 4, while should 0. if comment out either bytes.shareable = true; or _worker.setsharedproperty("bytes", bytes);, works perfectly, combination seems somehow disable clear() method.
curiously enough, however, happens when compiling air. when compiling flash player, clearing works should , code traces 0.
anybody know what's up?
Comments
Post a Comment