<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Displaying XML data in a DataGrid</title>
	<link>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 09:24:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-16220</link>
		<author>peterd</author>
		<pubDate>Fri, 17 Oct 2008 08:06:48 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-16220</guid>
		<description>Aaron S.,

I've never tried that, but I'm guessing it should work. I have an example of the FileReference class's new &lt;code&gt;load()&lt;/code&gt; method at http://blog.flexexamples.com/2008/08/25/previewing-an-image-before-uploading-it-using-the-filereference-class-in-flash-player-10/

This code is fairly untested (I only quickly checked it locally, not from a remote webserver), but this may help get you started:
&lt;pre class="code"&gt;
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;FxApplication name=&#34;DefineFont4_cff_test&#34;
        xmlns=&#34;http://ns.adobe.com/mxml/2009&#34;&#62;
    &#60;layout&#62;
        &#60;BasicLayout /&#62;
    &#60;/layout&#62;

    &#60;Style&#62;
        VGroup {
            left: 10;
            right: 10;
            top: 10;
            bottom: 10;
        }
    &#60;/Style&#62;

    &#60;Script&#62;
        &#60;![CDATA[
            private var fileRef:FileReference;

            private function button_click(evt:MouseEvent):void {
                var xmlFileFilter:FileFilter = new FileFilter(&#34;XML files (.xml)&#34;, &#34;*.xml&#34;);
            
                fileRef = new FileReference();
                fileRef.addEventListener(Event.SELECT, fileRef_select);
                fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
                fileRef.browse([xmlFileFilter]);
            }

            private function fileRef_select(evt:Event):void {
                fileRef.load();
            }

            private function fileRef_complete(evt:Event):void {
                var len:int = fileRef.data.length;
                var str:String = fileRef.data.readUTFBytes(len);
                var dataXML:XML = new XML(str);
                textArea.text = dataXML.toXMLString();
            }
        ]]&#62;
    &#60;/Script&#62;

    &#60;VGroup&#62;
        &#60;Button id=&#34;button&#34;
                label=&#34;Load file...&#34;
                click=&#34;button_click(event);&#34; /&#62;
        &#60;TextArea id=&#34;textArea&#34;
                width=&#34;100%&#34;
                height=&#34;100%&#34; /&#62;
    &#60;/VGroup&#62;

&#60;/FxApplication&#62;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>Aaron S.,</p>
<p>I&#8217;ve never tried that, but I&#8217;m guessing it should work. I have an example of the FileReference class&#8217;s new <code>load()</code> method at <a href="http://blog.flexexamples.com/2008/08/25/previewing-an-image-before-uploading-it-using-the-filereference-class-in-flash-player-10/" rel="nofollow">http://blog.flexexamples.com/2008/08/25/previewing-an-image-before-uploading-it-using-the-filereference-class-in-flash-player-10/</a></p>
<p>This code is fairly untested (I only quickly checked it locally, not from a remote webserver), but this may help get you started:</p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;FxApplication name=&quot;DefineFont4_cff_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;&gt;
    &lt;layout&gt;
        &lt;BasicLayout /&gt;
    &lt;/layout&gt;

    &lt;Style&gt;
        VGroup {
            left: 10;
            right: 10;
            top: 10;
            bottom: 10;
        }
    &lt;/Style&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            private var fileRef:FileReference;

            private function button_click(evt:MouseEvent):void {
                var xmlFileFilter:FileFilter = new FileFilter(&quot;XML files (.xml)&quot;, &quot;*.xml&quot;);

                fileRef = new FileReference();
                fileRef.addEventListener(Event.SELECT, fileRef_select);
                fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
                fileRef.browse([xmlFileFilter]);
            }

            private function fileRef_select(evt:Event):void {
                fileRef.load();
            }

            private function fileRef_complete(evt:Event):void {
                var len:int = fileRef.data.length;
                var str:String = fileRef.data.readUTFBytes(len);
                var dataXML:XML = new XML(str);
                textArea.text = dataXML.toXMLString();
            }
        ]]&gt;
    &lt;/Script&gt;

    &lt;VGroup&gt;
        &lt;Button id=&quot;button&quot;
                label=&quot;Load file...&quot;
                click=&quot;button_click(event);&quot; /&gt;
        &lt;TextArea id=&quot;textArea&quot;
                width=&quot;100%&quot;
                height=&quot;100%&quot; /&gt;
    &lt;/VGroup&gt;

&lt;/FxApplication&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron S.</title>
		<link>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-16214</link>
		<author>Aaron S.</author>
		<pubDate>Thu, 16 Oct 2008 15:00:10 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-16214</guid>
		<description>Hi There, 

Thanks for the tutorial, it works great. Im wondering if its possible to change the data on the Fly.

for example, creating a FileReference variable and then using the fileRef.browse(); to browse for the .xml file you want to populate the grid with. 

Any ideas? 

Thanks - your site rocks.</description>
		<content:encoded><![CDATA[<p>Hi There, </p>
<p>Thanks for the tutorial, it works great. Im wondering if its possible to change the data on the Fly.</p>
<p>for example, creating a FileReference variable and then using the fileRef.browse(); to browse for the .xml file you want to populate the grid with. </p>
<p>Any ideas? </p>
<p>Thanks - your site rocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-12978</link>
		<author>peterd</author>
		<pubDate>Mon, 26 May 2008 03:07:53 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-12978</guid>
		<description>Business Minded,

The previous video doesn't display any video at all. It simply displays an XML packet in a Flex DataGrid control.
If you want to display a video you need to use the VideoDisplay control, or use the NetStream, NetConnection, and Video classes.

Peter</description>
		<content:encoded><![CDATA[<p>Business Minded,</p>
<p>The previous video doesn&#8217;t display any video at all. It simply displays an XML packet in a Flex DataGrid control.<br />
If you want to display a video you need to use the VideoDisplay control, or use the NetStream, NetConnection, and Video classes.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Business Minded</title>
		<link>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-12933</link>
		<author>Business Minded</author>
		<pubDate>Sun, 25 May 2008 15:16:56 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-12933</guid>
		<description>Somehow, I can't view the flash video. Could you please check into it?

Also, I tried the above code and it didn't load for me.  
var itemA:Number = parseInt(objA.Time.text()) as Number;
var itemB:Number = parseInt(objB.Time.text()) as Number;</description>
		<content:encoded><![CDATA[<p>Somehow, I can&#8217;t view the flash video. Could you please check into it?</p>
<p>Also, I tried the above code and it didn&#8217;t load for me.<br />
var itemA:Number = parseInt(objA.Time.text()) as Number;<br />
var itemB:Number = parseInt(objB.Time.text()) as Number;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: neox2</title>
		<link>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-6117</link>
		<author>neox2</author>
		<pubDate>Tue, 15 Jan 2008 19:42:29 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/#comment-6117</guid>
		<description>Hi, how can i refresh data?</description>
		<content:encoded><![CDATA[<p>Hi, how can i refresh data?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
