10
Jul

Where’s my byte, dude??!

While working on his famous library blooddy stuck upon what appeared to be a flash bug. Sometimes an empty ByteArray is not THAT empty at all.

Basically if you write something to it first you can get non-zero bytes in your new ByteArray other than you just wrote yourself.

bytes.writeUnsignedInt( 10 );
 bytes.length = LENGTH;

But if you set the length first everything runs smoothly. Be careful!

Tags: , ,