<?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: Using ActionScript 3.0 with PHP Part 1: Loading External Variables</title>
	<atom:link href="http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/</link>
	<description>Knowledge is Power.</description>
	<lastBuildDate>Mon, 07 Dec 2009 20:08:23 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jay Harley</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-9416</link>
		<dc:creator>Jay Harley</dc:creator>
		<pubDate>Mon, 07 Dec 2009 20:08:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-9416</guid>
		<description>Here is a post from Yen Liu (sent to me and posted here for edification):

Hi Jay,

Just wanted to say thanks for that tutorial, it was really helpful :-)

However for some reason I could only get the first variable (the username). This seemed strange so I did some debugging with *trace(evt.target.data)* and it showed this string

*username=John Doe&amp;email=johndoe@example.com

*The *&amp;e *seemed very suspicious, for one because the normal html entity for ampersand is &amp;
In any case, it seemed like Flash had issues with those symbols being there.

For people encountering the problem, the solution seems to be:

Replace the line *$returnString = http_build_query($returnVars);*

with *$returnString = http_build_query($returnVars, &#039;&#039;, &#039;&amp;&#039;); *

To be honest I don&#039;t understand why this works, but being explicit to PHP about using the &amp; sign as the argument separator seemed to have solved the problem - although this should be completely unnecessary.

Probably a bug in PHP?

Yen</description>
		<content:encoded><![CDATA[<p>Here is a post from Yen Liu (sent to me and posted here for edification):</p>
<p>Hi Jay,</p>
<p>Just wanted to say thanks for that tutorial, it was really helpful <img src='http://www.heaveninteractive.com/weblog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>However for some reason I could only get the first variable (the username). This seemed strange so I did some debugging with *trace(evt.target.data)* and it showed this string</p>
<p>*username=John Doe&amp;email=johndoe@example.com</p>
<p>*The *&amp;e *seemed very suspicious, for one because the normal html entity for ampersand is &amp;<br />
In any case, it seemed like Flash had issues with those symbols being there.</p>
<p>For people encountering the problem, the solution seems to be:</p>
<p>Replace the line *$returnString = http_build_query($returnVars);*</p>
<p>with *$returnString = http_build_query($returnVars, &#8221;, &#8216;&#038;&#8217;); *</p>
<p>To be honest I don&#8217;t understand why this works, but being explicit to PHP about using the &#038; sign as the argument separator seemed to have solved the problem &#8211; although this should be completely unnecessary.</p>
<p>Probably a bug in PHP?</p>
<p>Yen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pligg.com</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-8005</link>
		<dc:creator>pligg.com</dc:creator>
		<pubDate>Sat, 11 Jul 2009 03:32:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-8005</guid>
		<description>&lt;strong&gt;Using ActionScript 3.0 with PHP: Loading External Variables...&lt;/strong&gt;

This tutorial shows you how to load external data from php scripts using the URLLoader class, as well as how to handle the load completed event. It will help you get started using PHP and ActionScript 3.0 together....</description>
		<content:encoded><![CDATA[<p><strong>Using ActionScript 3.0 with PHP: Loading External Variables&#8230;</strong></p>
<p>This tutorial shows you how to load external data from php scripts using the URLLoader class, as well as how to handle the load completed event. It will help you get started using PHP and ActionScript 3.0 together&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Harley</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1709</link>
		<dc:creator>Jay Harley</dc:creator>
		<pubDate>Mon, 29 Sep 2008 21:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1709</guid>
		<description>Hi Jim

I had a similar problem once, I think it had to do with putting the ampersand in front of the return string.  

My advice is to try both methods: 

1) to echo &quot;&amp;firstValue&amp;secondValue&quot; 

and 

2) to echo &quot;firstValue&amp;secondValue&quot;

One of these is right, and one is wrong, I&#039;m not sure which. It&#039;s a flash quirk I believe. (One of many).</description>
		<content:encoded><![CDATA[<p>Hi Jim</p>
<p>I had a similar problem once, I think it had to do with putting the ampersand in front of the return string.  </p>
<p>My advice is to try both methods: </p>
<p>1) to echo &#8220;&#038;firstValue&#038;secondValue&#8221; </p>
<p>and </p>
<p>2) to echo &#8220;firstValue&#038;secondValue&#8221;</p>
<p>One of these is right, and one is wrong, I&#8217;m not sure which. It&#8217;s a flash quirk I believe. (One of many).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jiimathy</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1696</link>
		<dc:creator>jiimathy</dc:creator>
		<pubDate>Sun, 28 Sep 2008 16:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1696</guid>
		<description>I am having a problem using http_build_query. I get the first variable but that is all. Every other variable is undefined. If I format the return string from php as follows

$returnVars = &quot;username=John Doe&quot;;
$returnVars .= &quot;&amp;email=hotmail.com&quot;;
echo $returnVars;

No problem. However if you put the ampersand in the first name value pairing as follows:

 

The following error occurs in flash:

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()
	at Fetch_fla::MainTimeline/handleComplete()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()


If you examine the output of the example there is no ampersand on the first variable so flash should trace out both variables but I always get undefined for the second one.

Any one know why? Has anyone found a solution? I am running php 5.2.4 so there should be no problem with the php. I am going crazy. I can&#039;t say if you help me that I will love you for ever but you would make a grown man cry.

Thanks for any help.

imailjim@gmail.com

Jim</description>
		<content:encoded><![CDATA[<p>I am having a problem using http_build_query. I get the first variable but that is all. Every other variable is undefined. If I format the return string from php as follows</p>
<p>$returnVars = &#8220;username=John Doe&#8221;;<br />
$returnVars .= &#8220;&amp;email=hotmail.com&#8221;;<br />
echo $returnVars;</p>
<p>No problem. However if you put the ampersand in the first name value pairing as follows:</p>
<p>The following error occurs in flash:</p>
<p>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()<br />
	at Fetch_fla::MainTimeline/handleComplete()<br />
	at flash.events::EventDispatcher/dispatchEventFunction()<br />
	at flash.events::EventDispatcher/dispatchEvent()<br />
	at flash.net::URLLoader/onComplete()</p>
<p>If you examine the output of the example there is no ampersand on the first variable so flash should trace out both variables but I always get undefined for the second one.</p>
<p>Any one know why? Has anyone found a solution? I am running php 5.2.4 so there should be no problem with the php. I am going crazy. I can&#8217;t say if you help me that I will love you for ever but you would make a grown man cry.</p>
<p>Thanks for any help.</p>
<p><a href="mailto:imailjim@gmail.com">imailjim@gmail.com</a></p>
<p>Jim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Skoua</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1540</link>
		<dc:creator>Skoua</dc:creator>
		<pubDate>Mon, 15 Sep 2008 14:04:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1540</guid>
		<description>Thanks for this short tutorial, I didn&#039;t knew the power of URLRequest and URLLoader.
This is really to communicate between AS and PHP, just an echo, thought it would more difficult.

Thanks again!</description>
		<content:encoded><![CDATA[<p>Thanks for this short tutorial, I didn&#8217;t knew the power of URLRequest and URLLoader.<br />
This is really to communicate between AS and PHP, just an echo, thought it would more difficult.</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malinda</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1416</link>
		<dc:creator>Malinda</dc:creator>
		<pubDate>Fri, 29 Aug 2008 11:21:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1416</guid>
		<description>I am making progress. I have all the data now and in the right places - the only problem is that the data for each column is on the same line separated with commas. How do I get them to show up on separate lines? I tried adding \n to the php script, but that didn&#039;t work. I&#039;m not sure how I would accomplish that in ActionScript 3.</description>
		<content:encoded><![CDATA[<p>I am making progress. I have all the data now and in the right places &#8211; the only problem is that the data for each column is on the same line separated with commas. How do I get them to show up on separate lines? I tried adding \n to the php script, but that didn&#8217;t work. I&#8217;m not sure how I would accomplish that in ActionScript 3.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malinda</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1415</link>
		<dc:creator>Malinda</dc:creator>
		<pubDate>Fri, 29 Aug 2008 00:03:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1415</guid>
		<description>This tutorial was very helpful and I finally after many days got the php file to be seen by flash. When I do a trace statement all of the data shows up, but when I try to display the data only one line of the data displays and it&#039;s not the right data. Example the wrong last name is displayed next to the first name. If anyone can help me with this I will love you forever!</description>
		<content:encoded><![CDATA[<p>This tutorial was very helpful and I finally after many days got the php file to be seen by flash. When I do a trace statement all of the data shows up, but when I try to display the data only one line of the data displays and it&#8217;s not the right data. Example the wrong last name is displayed next to the first name. If anyone can help me with this I will love you forever!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1184</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Wed, 16 Jul 2008 15:17:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1184</guid>
		<description>Vic, 

I was getting the same problem - turned out that I had php 4.x on my hosting and the http_build_query isn&#039;t in that version, so the output was throwing an error in php that confused the hell out of flash...

Change   loader.dataFormat = URLLoaderDataFormat.VARIABLES;

To       // loader.dataFormat = URLLoaderDataFormat.VARIABLES;

And put  trace(evt.target.data);  into the completeHandler and you will be able to see the output from the php file (or you could look at the php file in a web browser)...

It&#039;s working fine now the PHP has been upgraded, but didn&#039;t seem to get it working in other ways...

Hope this helps

PS: Also had a problem where the PHP output file was being cached - watch out for that when making changes...

:)</description>
		<content:encoded><![CDATA[<p>Vic, </p>
<p>I was getting the same problem &#8211; turned out that I had php 4.x on my hosting and the http_build_query isn&#8217;t in that version, so the output was throwing an error in php that confused the hell out of flash&#8230;</p>
<p>Change   loader.dataFormat = URLLoaderDataFormat.VARIABLES;</p>
<p>To       // loader.dataFormat = URLLoaderDataFormat.VARIABLES;</p>
<p>And put  trace(evt.target.data);  into the completeHandler and you will be able to see the output from the php file (or you could look at the php file in a web browser)&#8230;</p>
<p>It&#8217;s working fine now the PHP has been upgraded, but didn&#8217;t seem to get it working in other ways&#8230;</p>
<p>Hope this helps</p>
<p>PS: Also had a problem where the PHP output file was being cached &#8211; watch out for that when making changes&#8230;<br />
 <img src='http://www.heaveninteractive.com/weblog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake Rutter</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1136</link>
		<dc:creator>Jake Rutter</dc:creator>
		<pubDate>Mon, 07 Jul 2008 22:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1136</guid>
		<description>Hi there,

Nice tutorial. Have you created part 2 yet? Im very interested in learning how to interact with php/mysql/xml and Flash.</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>Nice tutorial. Have you created part 2 yet? Im very interested in learning how to interact with php/mysql/xml and Flash.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: luiz</title>
		<link>http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/comment-page-1/#comment-1091</link>
		<dc:creator>luiz</dc:creator>
		<pubDate>Thu, 03 Jul 2008 04:39:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2008/03/17/using-actionscript-30-with-php-part-1/#comment-1091</guid>
		<description>I already had the same problem with the error message above. To solve it I just changed the VARIABLES, from the code, to TEXT. The compiler showed none error message now. Good blog, however I found some problems in implementing the code above, probably because I just started programming in AS3, I will trying a little harder.</description>
		<content:encoded><![CDATA[<p>I already had the same problem with the error message above. To solve it I just changed the VARIABLES, from the code, to TEXT. The compiler showed none error message now. Good blog, however I found some problems in implementing the code above, probably because I just started programming in AS3, I will trying a little harder.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.402 seconds -->
