-
1. Re: Bug in byteArray 's method readBytes
Raymond Basque Jun 16, 2011 6:12 AM (in response to Chrestang)The second argument is the offset of the destination ByteArray.
You are reading 4 bytes from the source (data) and inserting those 4 bytes at offset 16 of chunkData - therefore chunkData.length is 20;
-
2. Re: Bug in byteArray 's method readBytes
Chrestang Jun 16, 2011 6:18 AM (in response to Raymond Basque)Ok so if I want to read from the 16 to the 20, what to do?
Where does it start reading from? data.position or 0?
It is a bit wird that the offset is where the data is written in the new bytearray not where it starts reading from.
-
3. Re: Bug in byteArray 's method readBytes
Chrestang Jun 16, 2011 6:25 AM (in response to Raymond Basque)Ok it starts reading from data.position and the amount indicated. So it is not a bug it is a feature.
So the correct way is:
data.position = 16
data.readBytes(chunkData, 0, 4);
RTFM: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html#r eadBytes() I just checked the short version out.
Thanks
-
4. Re: Bug in byteArray 's method readBytes
Raymond Basque Jun 16, 2011 6:24 AM (in response to Chrestang)data.position=16;
data.readBytes(chunkData, 0, 4);
Once executed data.position will be 20 and chunkData will have 4 bytes.

