private var buffer:ByteArray;
private function onData(event:ProgressEvent):void
{
socket.readBytes(buffer, buffer.length);
var bytes:ByteArray = new ByteArray();
buffer.readBytes(bytes, 0, messageLength);
buffer.position = bytes.length;
trim();
// deserialize the message in bytes now
}
private function trim():void
{
var bytes:ByteArray = new ByteArray();
bytes.writeBytes(buffer, buffer.position);
buffer = bytes;
buffer.position = 0;
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders