views:

100

answers:

1

I have a XMLSocket and I call send twice in the same function. The first send works but the second does not? Does XMLSocket have a restriction to only send one message per frame? Do I have to queue messages and have an onEnterFrame function that checks the queue and sends one message for a frame?

+1  A: 

You have to flush the output buffer when you use the Socket class. Example:

public static function write(msg:String):void
{
    socket.writeUTFBytes(msg);
    socket.flush();
}

However, you're saying that you're using the XMLSocket class? That one provides less lower level posibilities and should already do the flushing for you so I don't think you'd have this problem if your code is correct.

You could try to use the lower level Socket class, and flush the output buffer manually every time you call the write method. See: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/Socket.html

Tom
I need the fla to work on a Windows Mobile device so I have to use Flash 7 which does not have the Socket class.
zooropa