View Full Version : Reading a Byte in a Byte Array
jmjw1985
August 21st, 2008, 11:52 AM
I'm trying to read and process single values stored within the computeSpectrum byte array. I am unsure how to pick out individual bytes from a specific location within the array, then convert them to numbers.
Can anyone help? Did I make sense?
Thanks.
wvxvw
August 21st, 2008, 12:08 PM
Number is a double, which means it is 8 bytes long (int is 4 bytes long with the last padding bit responsible for sign, uint is 4 bytes long without sign).
To read from ByteArray from defined position do smth. like this:
myByteArray.position = myPosition; //myPosition is integer
var i:int = myByteArray.readInt(); // reads 4 bytes
var i:int = myByteArray.readByte(); // reads single byte
var i:Number = myByteArray.readDouble(); // reads 8 bytes
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.