PDA

View Full Version : As -> Php -> Xml -> As


paintballa_4life2003
05-13-2006, 09:39 AM
I am wondering if it is possible to execute a PHP script which outputs an XML file from ActionScript.

I have an ActionScript which reads in XML data. The XML file is generated by a PHP script, but I want the XML data updated each time a user loads my movie. Is there any way to execute the PHP from within ActionScript so the file does get outputted? I don't need to pass any variables, what's the easiest way to do this without having to re-write my PHP?

[Sx]
05-13-2006, 10:23 AM
There are like 1000 examples of that on this forum, don't be lazy and do a little research.

Basically, you need either LoadVars.sendAndLoad() or XML.sendAndLoad() methods for good communication with the backend...

paintballa_4life2003
05-13-2006, 10:36 AM
EDIT: I got it working, no help needed, thanks anyway.

I'm not bein lazy i've been Researchin it. i found this
http://www.actionscript.org/forums/showthread.php3?t=88684&highlight=ActionScript+PHP+output+file
and i've been tryin to go from that but so far no luck. My PHP script doesn't even execute. I have found many posts but none of them helped. I have no idea what i'm doin wrong. Here is what I have so far...

ActionScript:
PHPScriptcall.onLoad = function(success)
{
if(success)
{
trace("It Worked!");
}
else
{
trace("It Didn't Work!");
}
}

PHPScriptCall.sendAndLoad("http://localhost/data_to_xml.php");

The PHP script is irrelevant since it does not expect any parameters and all it does is output the XML file. I know the PHP is working fine, but the ActionScript won't call it.