Jiri wrote: > So each element in a ByteArray can hold 8 bits. > What about the readInt() method of the ByteArray, does an integer then > span over 4 elements of the bytearray. And if I start at position 0 and > then call the readInt(), is the position after that then 4?
Essentially, yes. A ByteArray is a packed array of bytes. Or, put another way, it stores the most compact representation of a data type, but you can still access each byte with the [] array access. Consider the following (e-mail AS3--don't count on it to be bug-free): var myByteArr:ByteArray = new ByteArray(); myByteArr.writeInt (2695938256); trace (myByteArr.length); //4 trace (myByteArr[0]); //208 trace (myByteArr[1]); //192 trace (myByteArr[2]); //176 trace (myByteArr[3]); //160 trace (myByteArr.readInt()); //2695938256 I chose that rather odd number because it was a convenient hex number, #A0B0C0D0. Doing a trace on a ByteArray element returns the decimal equivalent of the byte. It's possible I got the order reversed--I didn't test the code. #A0 might be in the 0th element. Nonetheless, I think the code represents the concept reasonably well. Cordially, Kerry Thompson _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

