<mx:XML id="xxx" source="/xml.xml" />.
Question: How can we do the same in AS?
Answer: "The same" - noway, but we can do this "much as the same"
/**
* Parse embedded data as String:
* [Embed(source="/text.txt", mimeType="application/octet-stream")]
* private static const embeddedData:Class;
*/
public static function getEmbeddedString(embedApplicationOctetStreamData:Class):String
{
var embedData:ByteArrayAsset = ByteArrayAsset(new embedApplicationOctetStreamData());
return embedData.readUTFBytes(embedData.length);
}
/**
* Parse embedded data as XML file:
* [Embed(source="/xml.xml", mimeType="application/octet-stream")]
* private static const embeddedData:Class;
*/
public static function getEmbeddedXML(embedApplicationOctetStreamData:Class):XML
{
var embedData:ByteArrayAsset = ByteArrayAsset(new embedApplicationOctetStreamData());
return new XML(embedData.readUTFBytes(embedData.length));
}