AS3 convert ByteArray of ARGB values to RGB uint
===

I have a C++ QT application that is sending an ByteArray of ARGB values via a tcp socket. The image is 100 x 100.

Problem is that when I read off the ByteArray I can't seem to get the image to display right. I've tried loads of different ways and here is AS3 code that's got me the closest.

				bitmapData.lock();
				for(var x = 0;x<100; x++){
					for(var y = 0;y<100; y++){
						alphaValue = byteArray.readUnsignedByte();
						redValue = byteArray.readUnsignedByte();
						greenValue = byteArray.readUnsignedByte();
						blueValue = byteArray.readUnsignedByte();
						color = redValue << 16 | greenValue << 8 | blueValue;
						
						bitmapData.setPixel(y,x,color);
					}
				}
				bitmapData.unlock();

I'm just not using the alpha value at the moment because I'm not sure what to do with it. Qt says "The image is stored using a 32-bit RGB format (0xffRRGGBB)."

I tried using readUnsignedInt() to but that didn't work either.

Here is what I'm trying to send and what I see on screen.

Sent : ![enter image description here][1] Received in Flash ![enter image description here][2]

It's close, but not just right. Does anyone have any idea what I may be doing wrong?



  [1]: http://i.stack.imgur.com/DagPw.png
  [2]: http://i.stack.imgur.com/sDXwD.png