Are you new? Read the FAQ and catch up on!
143 views

Convert ByteArray to string or XML

When dealing with XML files in Flash, there are a lot of situations in which you need to convert a ByteArray to string or to XML. This is the easiest way to do it:

ActionScript
  1. // To String
  2. var string:String = byteArray.readUTFBytes(byteArray.length);
  3.  
  4. // To XML
  5. var xml:XML = new XML(byteArray.readUTFBytes(byteArray.length));
  6.  

­

Tags: ActionScript strings flash xml conversion bytearray

Embed: