title: AS3 URLStream cuts off first 4 characters of response
body: <p>I have a URLStream object which accepts an XML formatted response but unfortunately the first 4 characters of the response are being chopped off, making the xml malformed.</p>
  
  <p>The xml being returned from the server is correctly formatted if I use a URLLoader object.</p>
  
  <p>Would anyone know how to fix this?</p>
  
  <pre><code>private var _stream:URLStream;
  
  _myVariables = new URLVariables();
  
  _myVariables.email = _un;
  _urlRqSend = new URLRequest(_loginURL);
  
  var encoder:Base64Encoder = new Base64Encoder();        
  encoder.encode("password:"+_pw);
  
  var credsHeader:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + encoder.toString());
  _urlRqSend.requestHeaders.push(credsHeader);
  
  _urlRqSend.data = _myVariables;         
  _urlRqSend.method = URLRequestMethod.POST;      
  
  _stream = new URLStream();          
  _stream.addEventListener(flash.events.Event.COMPLETE, handleResponse);
  _stream.load(_urlRqSend);
  
  
  
  private function handleResponse(ev:flash.events.Event):void{    
  
  trace("returned data: ",_stream.readUTFBytes(_stream.bytesAvailable));
  
  }
  </code></pre>
  
  <p>Output</p>
  
  <p>//returned data: <code>l version="1.0"...etc</code></p>
  
  <p>The correct response should be </p>
  
  <p>//returned data: <code>&lt;?xml version="1.0"...etc</code></p>
  
  <p>Thanks</p>