I've added some traces there and see that this doesn't work:

                       if (_ba.bytesAvailable >= len) {
                               var str:String = _ba.readUTFBytes(len);
                               updateGUI(str);

                               // copy the remaining bytes
                               // (does it work? can it be improved?)
                               var newBA:ByteArray = new ByteArray();
                               newBA.readBytes(_ba);
                               _ba = newBA;
                       }

- the newBA.length stays zero.

Please help me with this little bit.

My problem is that when I read many bytes into my _ba
(i.e. if I read several messages at once) and then
process one message (with the updateGUI() above),
how do I get rid of those processed bytes?

I suppose I must somehow cut those processed
bytes away from the beginning of the _ba,
that is why I introduced copying into a newBA above,
but this doesn't work.

Regards
Alex
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to