onData and an obnoxious String

Very well… I don’t really know what’s wrong with this.
The Server connection works just fine, but the databuffer always appears to be empty if I try to access it (either directly or with a get-function).

If I trace databuffer in the onSocketData-function it returns the right value (that is a string from the server, like "|25| " terminated by the NULL-Character).

Any idea anyone?


class MySocket extends MovieClip
{
	var socket:XMLSocket;
	var port:Number;
	var databuffer:String;
	
	function MySocket(__port:Number)
	{
		socket = new XMLSocket();
		
		port = __port;

		if (!socket.connect("localhost", port)) 
				trace ("Connection failed!");
			
		socket.onConnect = onSocketConnect;	
		socket.onData = onSocketData;
		
		databuffer = new String();

		setInterval(this.request, 24, this.socket);
	}

	private function onSocketData(data:Object)
	{
	  var s:String = new String(String(data));
		databuffer = s.substring(0);
		trace(databuffer);
	}

	private function onSocketConnect(success:Boolean)
	{
		if (success)
			trace ("Connection succeeded!");
		else 
			trace ("Connection failed!");
	}
	
	/* request data function */
	
	function request(__socket:XMLSocket)
	{
		__socket.send("
");	
	}
}