Tag Archive for 'ByteArray'

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!

Great image distortion idea

Recently I wrote about my distortion effect. Believe me, I experimented with it a lot. And it was damn slow on big bitmaps. But here’s a funny way to do it through native jpeg decoding. And it runs smooth on relatively big bitmaps. The guy messes up with jpeg data in ByteArray many times in a row loading it over and over again. Letting Flash native jpeg decoder do the work for him. This is is a great example of creative thinking!