So you want to send XML in flash? There are some things that you need to watch out for.
ONE: We’re working with the XML object.
var myXML:XML = new XML();
var theXML:String = “”;
TWO: If you are are expecting a response, use the sendAndLoad() method. You will need to create an XML object to catch the response from your server. The sendAndLoad() method takes 3 parameters:
url – where to send the XML
target – The XML object that receives the downloaded data (this can also be a LoadVars object depending on the data that is returned from the service)
method – GET or POST HTTP protocol. This parameter is optional.
myXML.sendAndLoad(“http://www.realeyesmedia.com/”, responseXML, “POST”);
Now what happens if you don’t expect a response from the server? Do you use send()? Not if you don’t want the page to redirect.
The send() method can GET or POST your XML data to a page, but your Flash piece page is expected to redirect. So, what do you do. Well, just use sendAndLoad() and create a dummy XML object for the 2nd parameter. You won’t receive a response, but the XML will be sent to the server just the same.
powered by performancing firefox