<?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: Dynamically loading XML files using the HTTPService tag</title>
	<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Thu, 04 Dec 2008 23:32:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: michelle</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-16821</link>
		<author>michelle</author>
		<pubDate>Fri, 21 Nov 2008 03:21:37 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-16821</guid>
		<description>hi, 

i've tried inputting the code in Flex 3 but it has an error saying HTTP Request Error when i click on the gallery 1 link button. Any reason why?

I would like the thumbnails to appear when the page is loaded, how do i go about doing that?</description>
		<content:encoded><![CDATA[<p>hi, </p>
<p>i&#8217;ve tried inputting the code in Flex 3 but it has an error saying HTTP Request Error when i click on the gallery 1 link button. Any reason why?</p>
<p>I would like the thumbnails to appear when the page is loaded, how do i go about doing that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig M</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-15462</link>
		<author>Craig M</author>
		<pubDate>Wed, 10 Sep 2008 19:40:12 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-15462</guid>
		<description>Thanks for this!  This was exactly what I needed to get my app working.</description>
		<content:encoded><![CDATA[<p>Thanks for this!  This was exactly what I needed to get my app working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14287</link>
		<author>Joshua</author>
		<pubDate>Tue, 22 Jul 2008 16:33:32 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14287</guid>
		<description>With the AdvancedDataGrid, if you bind an XMLListCollection to the dataProvider it works perfectly.  However, if you bind the same XMLListCollection to the GroupCollection source so that you can do grouping and summary rows, it won't seem to accept it and instead throws an error.

To solve this, I switched my HTTPService from the format of "e4x" to "object" and it worked perfectly.  Basically, you just need a more basic data source it seems like an array or object?

Thought I'd note this since it took me a couple hours to figure out (yes, I'm new :)

.:Joshua</description>
		<content:encoded><![CDATA[<p>With the AdvancedDataGrid, if you bind an XMLListCollection to the dataProvider it works perfectly.  However, if you bind the same XMLListCollection to the GroupCollection source so that you can do grouping and summary rows, it won&#8217;t seem to accept it and instead throws an error.</p>
<p>To solve this, I switched my HTTPService from the format of &#8220;e4x&#8221; to &#8220;object&#8221; and it worked perfectly.  Basically, you just need a more basic data source it seems like an array or object?</p>
<p>Thought I&#8217;d note this since it took me a couple hours to figure out (yes, I&#8217;m new :)</p>
<p>.:Joshua</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Torres</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14255</link>
		<author>Miguel Torres</author>
		<pubDate>Sun, 20 Jul 2008 16:49:21 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14255</guid>
		<description>Hi,

I have found a method to automaticly load de XML file without pressing the button. I thought post it in here for anybody who has the same problem as I had.

I just added a creationComplete in the mx:Aplicaiton tag passing the "loadGallery ('gallery1.xml');"

This might NOT be best practice, but for now its the only way I know to make it work.

Again, thanks a lot for your great tuto´s and examples.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have found a method to automaticly load de XML file without pressing the button. I thought post it in here for anybody who has the same problem as I had.</p>
<p>I just added a creationComplete in the mx:Aplicaiton tag passing the &#8220;loadGallery (&#8217;gallery1.xml&#8217;);&#8221;</p>
<p>This might NOT be best practice, but for now its the only way I know to make it work.</p>
<p>Again, thanks a lot for your great tuto´s and examples.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Torres</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14226</link>
		<author>Miguel Torres</author>
		<pubDate>Fri, 18 Jul 2008 19:48:06 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14226</guid>
		<description>&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
		layout="vertical"
		verticalAlign="middle"
		backgroundColor="white"&#62;

	&#60;mx:Script&#62;
		&#60;![CDATA[
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.Alert;
			import mx.events.ListEvent;
			import mx.events.ItemClickEvent;
			import flash.net.URLRequest;


			private var alert:Alert;

			private function loadGallery(src:String):void {
				httpService.url = src;
				httpService.send();
			}

			private function httpService_fault(evt:FaultEvent):void {
				var title:String = evt.type + " (" + evt.fault.faultCode + ")";
				var text:String = evt.fault.faultString;
				alert = Alert.show(text, title);
				xmlListColl.removeAll();
			}

			private function httpService_result(evt:ResultEvent):void {
				var xmlList:XMLList = XML(evt.result).images.image;
				xmlListColl = new XMLListCollection(xmlList);
			}
			
			private function tileList_itemClick(evt:ListEvent):void {
            var link:URLRequest = new URLRequest(evt.itemRenderer.data.@url);
				navigateToURL(link);
			}
		]]&#62;
	&#60;/mx:Script&#62;

	&#60;mx:XMLListCollection id="xmlListColl" /&#62;
	
	&#60;mx:Button label="gallery 1" click="loadGallery('gallery1.xml');" /&#62;

	&#60;mx:HTTPService id="httpService"
			resultFormat="e4x"
			fault="httpService_fault(event);"
			result="httpService_result(event)" /&#62;

		
	&#60;mx:TileList id="tileList"
			dataProvider="{xmlListColl}"
			itemRenderer="TileListItemRenderer"
			columnCount="3"
			columnWidth="150"
			rowCount="2"
			rowHeight="100"
			itemClick="tileList_itemClick(event);"/&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
		layout="vertical"
		verticalAlign="middle"
		backgroundColor="white"&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.Alert;
			import mx.events.ListEvent;
			import mx.events.ItemClickEvent;
			import flash.net.URLRequest;

			private var alert:Alert;

			private function loadGallery(src:String):void {
				httpService.url = src;
				httpService.send();
			}

			private function httpService_fault(evt:FaultEvent):void {
				var title:String = evt.type + " (" + evt.fault.faultCode + ")";
				var text:String = evt.fault.faultString;
				alert = Alert.show(text, title);
				xmlListColl.removeAll();
			}

			private function httpService_result(evt:ResultEvent):void {
				var xmlList:XMLList = XML(evt.result).images.image;
				xmlListColl = new XMLListCollection(xmlList);
			}

			private function tileList_itemClick(evt:ListEvent):void {
            var link:URLRequest = new URLRequest(evt.itemRenderer.data.@url);
				navigateToURL(link);
			}
		]]&gt;
	&lt;/mx:Script&gt;

	&lt;mx:XMLListCollection id="xmlListColl" /&gt;

	&lt;mx:Button label="gallery 1" click="loadGallery('gallery1.xml');" /&gt;

	&lt;mx:HTTPService id="httpService"
			resultFormat="e4x"
			fault="httpService_fault(event);"
			result="httpService_result(event)" /&gt;

	&lt;mx:TileList id="tileList"
			dataProvider="{xmlListColl}"
			itemRenderer="TileListItemRenderer"
			columnCount="3"
			columnWidth="150"
			rowCount="2"
			rowHeight="100"
			itemClick="tileList_itemClick(event);"/&gt;

&lt;/mx:Application&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Torres</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14225</link>
		<author>Miguel Torres</author>
		<pubDate>Fri, 18 Jul 2008 19:47:14 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14225</guid>
		<description>&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
		layout="vertical"
		verticalAlign="middle"
		backgroundColor="white"&#62;

	&#60;mx:Script&#62;
		&#60;![CDATA[
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.Alert;
			import mx.events.ListEvent;
			import mx.events.ItemClickEvent;
			import flash.net.URLRequest;


			private var alert:Alert;

			private function loadGallery(src:String):void {
				httpService.url = src;
				httpService.send();
			}

			private function httpService_fault(evt:FaultEvent):void {
				var title:String = evt.type + " (" + evt.fault.faultCode + ")";
				var text:String = evt.fault.faultString;
				alert = Alert.show(text, title);
				xmlListColl.removeAll();
			}

			private function httpService_result(evt:ResultEvent):void {
				var xmlList:XMLList = XML(evt.result).images.image;
				xmlListColl = new XMLListCollection(xmlList);
			}
			
			private function tileList_itemClick(evt:ListEvent):void {
            var link:URLRequest = new URLRequest(evt.itemRenderer.data.@url);
				navigateToURL(link);
			}
		]]&#62;
	&#60;/mx:Script&#62;

	&#60;mx:XMLListCollection id="xmlListColl" /&#62;
	
	&#60;mx:Button label="gallery 1" click="loadGallery('gallery1.xml');" /&#62;

	&#60;mx:HTTPService id="httpService"
			resultFormat="e4x"
			fault="httpService_fault(event);"
			result="httpService_result(event)" /&#62;

		
	&#60;mx:TileList id="tileList"
			dataProvider="{xmlListColl}"
			itemRenderer="TileListItemRenderer"
			columnCount="3"
			columnWidth="150"
			rowCount="2"
			rowHeight="100"
			itemClick="tileList_itemClick(event);"/&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
		layout="vertical"
		verticalAlign="middle"
		backgroundColor="white"&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
			import mx.controls.Alert;
			import mx.events.ListEvent;
			import mx.events.ItemClickEvent;
			import flash.net.URLRequest;

			private var alert:Alert;

			private function loadGallery(src:String):void {
				httpService.url = src;
				httpService.send();
			}

			private function httpService_fault(evt:FaultEvent):void {
				var title:String = evt.type + " (" + evt.fault.faultCode + ")";
				var text:String = evt.fault.faultString;
				alert = Alert.show(text, title);
				xmlListColl.removeAll();
			}

			private function httpService_result(evt:ResultEvent):void {
				var xmlList:XMLList = XML(evt.result).images.image;
				xmlListColl = new XMLListCollection(xmlList);
			}

			private function tileList_itemClick(evt:ListEvent):void {
            var link:URLRequest = new URLRequest(evt.itemRenderer.data.@url);
				navigateToURL(link);
			}
		]]&gt;
	&lt;/mx:Script&gt;

	&lt;mx:XMLListCollection id="xmlListColl" /&gt;

	&lt;mx:Button label="gallery 1" click="loadGallery('gallery1.xml');" /&gt;

	&lt;mx:HTTPService id="httpService"
			resultFormat="e4x"
			fault="httpService_fault(event);"
			result="httpService_result(event)" /&gt;

	&lt;mx:TileList id="tileList"
			dataProvider="{xmlListColl}"
			itemRenderer="TileListItemRenderer"
			columnCount="3"
			columnWidth="150"
			rowCount="2"
			rowHeight="100"
			itemClick="tileList_itemClick(event);"/&gt;

&lt;/mx:Application&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Torres</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14224</link>
		<author>Miguel Torres</author>
		<pubDate>Fri, 18 Jul 2008 19:44:42 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14224</guid>
		<description>This is the code i am working on rite now, actually its your code, modified by me ;) 
Thanks
</description>
		<content:encoded><![CDATA[<p>This is the code i am working on rite now, actually its your code, modified by me ;)<br />
Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Torres</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14223</link>
		<author>Miguel Torres</author>
		<pubDate>Fri, 18 Jul 2008 19:40:47 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14223</guid>
		<description>Hi Peterd, first of all i want to thank you for all your great tutorials and example files, you are a life saver!!!
I have modified this example of yours becouse i only want to load 1 gallery XML file. 
But i am experiencing much errors. 
I would like the TileList to load the "gallery1.xml"file automatic without the end-user clicking on the button.

I really tried everything i thought would fix this, but no success.

Thanks again, have a nice day.


-------------
Miguel Torres</description>
		<content:encoded><![CDATA[<p>Hi Peterd, first of all i want to thank you for all your great tutorials and example files, you are a life saver!!!<br />
I have modified this example of yours becouse i only want to load 1 gallery XML file.<br />
But i am experiencing much errors.<br />
I would like the TileList to load the &#8220;gallery1.xml&#8221;file automatic without the end-user clicking on the button.</p>
<p>I really tried everything i thought would fix this, but no success.</p>
<p>Thanks again, have a nice day.</p>
<p>&#8212;&#8212;&#8212;&#8212;-<br />
Miguel Torres</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sameer</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14089</link>
		<author>sameer</author>
		<pubDate>Fri, 11 Jul 2008 06:37:38 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-14089</guid>
		<description>I'm following up with this example but When I click the Button to load gallery. I get the Following error. I'm using Flex Builder 3. 

Error: Unable to load ''.
	at mx.controls::SWFLoader/loadContent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1368]
	at mx.controls::SWFLoader/load()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1211]
	at mx.controls::SWFLoader/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1015]
	at mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5670]
	at mx.managers::LayoutManager/validateClient()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:791]
	at mx.controls.listClasses::TileBase/measureWidthOfItems()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\listClasses\TileBase.as:1860]
	at mx.controls.listClasses::TileBase/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\listClasses\TileBase.as:2327]
	at mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5670]
	at mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:519]
	at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:669]
	at Function/http://adobe.com/AS3/2006/builtin::apply()
	at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]
	at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]</description>
		<content:encoded><![CDATA[<p>I&#8217;m following up with this example but When I click the Button to load gallery. I get the Following error. I&#8217;m using Flex Builder 3. </p>
<p>Error: Unable to load &#8221;.<br />
	at mx.controls::SWFLoader/loadContent()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1368]<br />
	at mx.controls::SWFLoader/load()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1211]<br />
	at mx.controls::SWFLoader/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\SWFLoader.as:1015]<br />
	at mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5670]<br />
	at mx.managers::LayoutManager/validateClient()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:791]<br />
	at mx.controls.listClasses::TileBase/measureWidthOfItems()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\listClasses\TileBase.as:1860]<br />
	at mx.controls.listClasses::TileBase/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\listClasses\TileBase.as:2327]<br />
	at mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:5670]<br />
	at mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:519]<br />
	at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:669]<br />
	at Function/http://adobe.com/AS3/2006/builtin::apply()<br />
	at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]<br />
	at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cedric</title>
		<link>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-13278</link>
		<author>Cedric</author>
		<pubDate>Sat, 07 Jun 2008 10:52:57 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservice-tag/#comment-13278</guid>
		<description>How do I reload the data of the XMLListCollection?
&lt;pre class="code"&gt;
&#60;mx:HTTPService id="xml_httpservice_q1" url="q1.php?randomnumber=(randomnumber)" resultFormat="e4x"/&#62;
&#60;mx:XMLListCollection id="xml_result_q1" source="{xml_httpservice_q1.lastResult.resultaat}"/&#62;
&lt;/pre&gt;

and on creationComplete: &lt;code&gt;xml_httpservice_q1.send();&lt;/code&gt;

I get the XML data, no problem there.

when I perform &lt;code&gt;xml_httpservice_q1.send();&lt;/code&gt; a second time (I want to reload the data from the q1.php since it has changed), I receive the following error:
&lt;blockquote&gt;
warning: unable to bind to property 'resultaat' on class 'XML' (class is not an IEventDispatcher)
&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<p>How do I reload the data of the XMLListCollection?</p>
<pre class="code">
&lt;mx:HTTPService id="xml_httpservice_q1" url="q1.php?randomnumber=(randomnumber)" resultFormat="e4x"/&gt;
&lt;mx:XMLListCollection id="xml_result_q1" source="{xml_httpservice_q1.lastResult.resultaat}"/&gt;
</pre>
<p>and on creationComplete: <code>xml_httpservice_q1.send();</code></p>
<p>I get the XML data, no problem there.</p>
<p>when I perform <code>xml_httpservice_q1.send();</code> a second time (I want to reload the data from the q1.php since it has changed), I receive the following error:</p>
<blockquote><p>
warning: unable to bind to property &#8216;resultaat&#8217; on class &#8216;XML&#8217; (class is not an IEventDispatcher)
</p></blockquote>
]]></content:encoded>
	</item>
</channel>
</rss>
