<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.4" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: XMLAsset: API for embedded XML files</title>
	<link>http://www.ericfeminella.com/blog/2008/07/27/xmlasset-api/</link>
	<description></description>
	<pubDate>Thu, 08 Jan 2009 11:56:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>

	<item>
		<title>by: Erik</title>
		<link>http://www.ericfeminella.com/blog/2008/07/27/xmlasset-api/#comment-81775</link>
		<pubDate>Mon, 28 Jul 2008 09:12:38 +0000</pubDate>
		<guid>http://www.ericfeminella.com/blog/2008/07/27/xmlasset-api/#comment-81775</guid>
					<description>There is another way. This requires a bit different implementation of XMLAsset. From the top of my head:

package com.ericfeminella.xml.XMLAsset
{
    import flash.utils.ByteArray;
    
    public class XMLAsset extends ByteArray
    {
        private var _xml:XML;

        public function get xml():XML
        {
             if (!_xml)
             {
                 position = 0;
                 _xml = new XML(readUTFBytes(bytesAvailable));
             }
             return _xml;
        }
    }

}


package
{
    import com.ericfeminella.xml.XMLAsset;

    [Embed("config.xml", mimeType="application/octet-stream")]
    public class Config extends XMLAsset
    {
    }
}

var config:Config = new Config();
trace( config.xml.toXMLString() );


Greetz Erik</description>
		<content:encoded><![CDATA[<p>There is another way. This requires a bit different implementation of XMLAsset. From the top of my head:</p>
<p>package com.ericfeminella.xml.XMLAsset<br />
{<br />
    import flash.utils.ByteArray;</p>
<p>    public class XMLAsset extends ByteArray<br />
    {<br />
        private var _xml:XML;</p>
<p>        public function get xml():XML<br />
        {<br />
             if (!_xml)<br />
             {<br />
                 position = 0;<br />
                 _xml = new XML(readUTFBytes(bytesAvailable));<br />
             }<br />
             return _xml;<br />
        }<br />
    }</p>
<p>}</p>
<p>package<br />
{<br />
    import com.ericfeminella.xml.XMLAsset;</p>
<p>    [Embed(&#8221;config.xml&#8221;, mimeType=&#8221;application/octet-stream&#8221;)]<br />
    public class Config extends XMLAsset<br />
    {<br />
    }<br />
}</p>
<p>var config:Config = new Config();<br />
trace( config.xml.toXMLString() );</p>
<p>Greetz Erik
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
