PDA

View Full Version : PHP to retrieve XML file from server, pass on to Flash AS3.


atksheu
10-24-2009, 07:26 AM
Hi everyone.

I am new at server side scripting, so I apologize in advance if the way I'm thinking about solving this problem is totally off.

I would like to take an xml file that is the RSS feed of a WordPress blog, and pass that on in its entirety (as a variable) to a Flash document. I am using Actionscript 3.0. I've seen a lot of posts about using PHP to generate an xml file, or query parts of an xml file on a server, but I still don't know if it's possible to pass on the entire file to the swf.

I had originally tried to load the XML file directly by its web address using the Loader class. It works when I am testing the swf on my machine, in the Flash authoring environment. However, once exported, the swf must prompt the user to change their Flash Player security settings, before it is able to communicate with an Internet-enabled location. My goal with the php is to circumvent that, and have a php script get the xml file from the server, pass it on to the JavaScript in the main HTML, and on the the Flash file.

Thanks a lot. I hope I've been clear in my explanation. Any help would be greatly appreciated!!

sneakyimp
11-21-2009, 05:56 PM
Do you have the PHP script fetching XML from the RSS feed yet? If so, just echo it from your PHP script:

// assuming you've fetched the rss in xml format and the contents are in the var $rss

header("Content-Type: application/xml; charset=ISO-8859-1");
echo $rss;


EDIT: and change your flash movie to fetch its xml from your php script.