<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Loading files using the URLLoader and URLVariables classes</title>
	<atom:link href="http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 19:26:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Krishna</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-10359</link>
		<dc:creator>Krishna</dc:creator>
		<pubDate>Fri, 03 Feb 2012 06:19:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-10359</guid>
		<description>Hi all, 
My remote swf file needs to load xml file which is residing outside of war file like property file. When I try with  URLRequest, I am getting error like &quot;Remote SWFs may not access local files&quot;. Can anyone help me to resolve this issue please?</description>
		<content:encoded><![CDATA[<p>Hi all,<br />
My remote swf file needs to load xml file which is residing outside of war file like property file. When I try with  URLRequest, I am getting error like &#8220;Remote SWFs may not access local files&#8221;. Can anyone help me to resolve this issue please?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zack</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-10260</link>
		<dc:creator>Zack</dc:creator>
		<pubDate>Tue, 20 Dec 2011 17:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-10260</guid>
		<description>Your probably using this line of code:

loader.dataFormat = URLLoaderDataFormat.VARIABLES;

Right?  

I don&#039;t know what the deal is, but it seems there is a mistake with the URLLoaderDataFormat, change your type to URLLoaderDataFormat.TEXT or URLLoaderDataFormat.BINARY or make the line say this instead:

loader.dataFormat = &quot;VARIABLES&quot;; 
and it should work.  The URLLoaderDataFormat.VARIABLES is &quot;variables&quot; instead of &quot;VARIABLES&quot;.</description>
		<content:encoded><![CDATA[<p>Your probably using this line of code:</p>
<p>loader.dataFormat = URLLoaderDataFormat.VARIABLES;</p>
<p>Right?  </p>
<p>I don&#8217;t know what the deal is, but it seems there is a mistake with the URLLoaderDataFormat, change your type to URLLoaderDataFormat.TEXT or URLLoaderDataFormat.BINARY or make the line say this instead:</p>
<p>loader.dataFormat = &#8220;VARIABLES&#8221;;<br />
and it should work.  The URLLoaderDataFormat.VARIABLES is &#8220;variables&#8221; instead of &#8220;VARIABLES&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-9075</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Wed, 23 Mar 2011 15:13:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-9075</guid>
		<description>@jacob,

You would need to use a server side language such as ColdFusion, or PHP to get a directory listing and then return the list of files/attributes to Flash Player using XML or some other format.

Peter</description>
		<content:encoded><![CDATA[<p>@jacob,</p>
<p>You would need to use a server side language such as ColdFusion, or PHP to get a directory listing and then return the list of files/attributes to Flash Player using XML or some other format.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jacob</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-9072</link>
		<dc:creator>jacob</dc:creator>
		<pubDate>Wed, 23 Mar 2011 12:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-9072</guid>
		<description>hi,
I&#039;m not sure if this is the right place to ask my question, but here  goes.

I need a simple array with filenames that are inside a given directory.
so, I have a function getallfilesinfolder(foldername:string):array
{
var arr:Array = new Array();

return arr;
}

lets say i have a folder called www.mywebsite.com/images/cars/

inside that cars folder are an x number of images (jpg, png)

---------
in air i use this:
public function getallfilesinfolder(foldername:String):Array
{
var filearray:Array=new Array();
var directory:File = File.applicationDirectory;
directory = directory.resolvePath(&quot;gardenimages/&quot;+foldername+&quot;&quot;);
var contents:Array = directory.getDirectoryListing(); 
for (var i:Number = 0; i &lt; contents.length; i++)
			{ 
			  	if(contents[i].type==&quot;.jpg&quot; &#124;&#124;contents[i].type==&quot;.JPG&quot; &#124;&#124; contents[i].type==&quot;.png&quot;)			  	filearray.push(contents[i].nativePath);
} 
return filearray;
}
---------


How do i get a list of filenames from the server?</description>
		<content:encoded><![CDATA[<p>hi,<br />
I&#8217;m not sure if this is the right place to ask my question, but here  goes.</p>
<p>I need a simple array with filenames that are inside a given directory.<br />
so, I have a function getallfilesinfolder(foldername:string):array<br />
{<br />
var arr:Array = new Array();</p>
<p>return arr;<br />
}</p>
<p>lets say i have a folder called <a href="http://www.mywebsite.com/images/cars/" rel="nofollow">http://www.mywebsite.com/images/cars/</a></p>
<p>inside that cars folder are an x number of images (jpg, png)</p>
<p>&#8212;&#8212;&#8212;<br />
in air i use this:<br />
public function getallfilesinfolder(foldername:String):Array<br />
{<br />
var filearray:Array=new Array();<br />
var directory:File = File.applicationDirectory;<br />
directory = directory.resolvePath(&#8220;gardenimages/&#8221;+foldername+&#8221;");<br />
var contents:Array = directory.getDirectoryListing();<br />
for (var i:Number = 0; i &lt; contents.length; i++)<br />
			{<br />
			  	if(contents[i].type==&quot;.jpg&quot; ||contents[i].type==&quot;.JPG&quot; || contents[i].type==&quot;.png&quot;)			  	filearray.push(contents[i].nativePath);<br />
}<br />
return filearray;<br />
}<br />
&#8212;&#8212;&#8212;</p>
<p>How do i get a list of filenames from the server?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kapil</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-8886</link>
		<dc:creator>kapil</dc:creator>
		<pubDate>Mon, 24 Jan 2011 10:20:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-8886</guid>
		<description>hi frnds,
              I m using URLVariables / url loader properties for exporting csv results..

but i m getting this error,
can anyone pls solve this problem?
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
	at Error$/throwError()
	at flash.net::URLVariables/decode()
	at flash.net::URLVariables()</description>
		<content:encoded><![CDATA[<p>hi frnds,<br />
              I m using URLVariables / url loader properties for exporting csv results..</p>
<p>but i m getting this error,<br />
can anyone pls solve this problem?<br />
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.<br />
	at Error$/throwError()<br />
	at flash.net::URLVariables/decode()<br />
	at flash.net::URLVariables()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-7433</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 06 Apr 2010 01:17:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-7433</guid>
		<description>This is as simple as it get AlCapone</description>
		<content:encoded><![CDATA[<p>This is as simple as it get AlCapone</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AlCapone</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-6400</link>
		<dc:creator>AlCapone</dc:creator>
		<pubDate>Thu, 19 Nov 2009 12:44:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-6400</guid>
		<description>hey guys, 
why dont u just show any simple example about URLLoader instead of this nauseous code?</description>
		<content:encoded><![CDATA[<p>hey guys,<br />
why dont u just show any simple example about URLLoader instead of this nauseous code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alice</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-149</link>
		<dc:creator>Alice</dc:creator>
		<pubDate>Wed, 15 Apr 2009 15:11:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-149</guid>
		<description>I am having problems with this URLLoader. When I run the app, I initialize a URLLoader object to get my XML. The first I get my data it&#039;s find. I go to update the data, the data is sent from Flex to a webservice. The webservice saves the data. Trust. I checked. It did overwrite the file and save properly. Flex received word that the webservice call was successfully, so go to load that same xml file again. It loads, but it loads the previous stuff, not exactly the new file. What am I doing wrong?</description>
		<content:encoded><![CDATA[<p>I am having problems with this URLLoader. When I run the app, I initialize a URLLoader object to get my XML. The first I get my data it&#8217;s find. I go to update the data, the data is sent from Flex to a webservice. The webservice saves the data. Trust. I checked. It did overwrite the file and save properly. Flex received word that the webservice call was successfully, so go to load that same xml file again. It loads, but it loads the previous stuff, not exactly the new file. What am I doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: buzo</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-154</link>
		<dc:creator>buzo</dc:creator>
		<pubDate>Wed, 08 Apr 2009 18:47:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-154</guid>
		<description>Hi Dharmendra:

from the Flex docs, it seems that the URLVariables class is meant to be used for passing url parameters when constructing a request going from the client to the server (in here is being used for parsing properties which is slightly different).  What I&#039;ve found is that the URLVariables class tokenizes the variables using the &amp; as a delimiter, so:

var vars:URLVariables = new URLVariables(&quot;a=foo&amp;b=baz&amp;c=bar&quot;);

will be correctly split as name-value pairs.  This is the reason why you only see the first name-value pair from your properties file, as this file uses a new line character as the tokenizer.

I got the example provided above to work by replacing the code:

                        var vars:URLVariables = new URLVariables(ldr.data);
                        var key:String;

                        for (key in vars) {
                            paramColl.addItem({key:key, value:vars[key]});
                        }

with:

                        var lines:Array = ( ldr.data as String ).split( &quot;\n&quot; );

                        for each ( var line:String in lines ) {
                        	var pair:Array = line.split( &quot;=&quot; );
                        	paramColl.addItem( { key:pair[0], value:pair[1] } );
                        }

Thank you very much to Peter for sharing the snippet.</description>
		<content:encoded><![CDATA[<p>Hi Dharmendra:</p>
<p>from the Flex docs, it seems that the URLVariables class is meant to be used for passing url parameters when constructing a request going from the client to the server (in here is being used for parsing properties which is slightly different).  What I&#8217;ve found is that the URLVariables class tokenizes the variables using the &amp; as a delimiter, so:</p>
<p>var vars:URLVariables = new URLVariables(&#8220;a=foo&amp;b=baz&amp;c=bar&#8221;);</p>
<p>will be correctly split as name-value pairs.  This is the reason why you only see the first name-value pair from your properties file, as this file uses a new line character as the tokenizer.</p>
<p>I got the example provided above to work by replacing the code:</p>
<p>                        var vars:URLVariables = new URLVariables(ldr.data);<br />
                        var key:String;</p>
<p>                        for (key in vars) {<br />
                            paramColl.addItem({key:key, value:vars[key]});<br />
                        }</p>
<p>with:</p>
<p>                        var lines:Array = ( ldr.data as String ).split( &#8220;\n&#8221; );</p>
<p>                        for each ( var line:String in lines ) {<br />
                        	var pair:Array = line.split( &#8220;=&#8221; );<br />
                        	paramColl.addItem( { key:pair[0], value:pair[1] } );<br />
                        }</p>
<p>Thank you very much to Peter for sharing the snippet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mandy</title>
		<link>http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/comment-page-1/#comment-153</link>
		<dc:creator>Mandy</dc:creator>
		<pubDate>Wed, 11 Feb 2009 08:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/loading-files-using-the-urlloader-and-urlvariables-classes/#comment-153</guid>
		<description>Can i set this  [Bindable]
            private var VARIABLES_URL:String = &quot;params.txt&quot;;
to a php page?</description>
		<content:encoded><![CDATA[<p>Can i set this  [Bindable]<br />
            private var VARIABLES_URL:String = &#8220;params.txt&#8221;;<br />
to a php page?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

