DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Actionscript 3 : Sending Name/value Pairs To A Server Side Script With The URLVariables Class
// description of your code here
//www.tournasdimitrios1.wordpress.com
import flash.events.Event;
import flash.net.*;
var myRequest:URLRequest = new URLRequest("http://www.myserver.com/myscript.php");
myRequest.method = URLRequestMethod.GET;
var myLoader:URLLoader = new URLLoader();
var myVariables:URLVariables = new URLVariables();
myVariables.firstProperty = "first";
myVariables.secondProperty = "second";
myRequest.data = myVariables;
function onLoaded(evt:Event):void {
trace("here we get the data back: "+myLoader.data);
}
myLoader.addEventListener(Event.COMPLETE, onLoaded);
myLoader.load(myRequest);
// send an XML file to your server side script
import flash.events.Event;
import flash.net.*;
var myRequest:URLRequest = new URLRequest("http://www.myserver.com/myscript.php");
myRequest.contentType = "text/xml";
myRequest.data = myXML;
var myLoader:URLLoader = new URLLoader();
var myXML:XML = Hello World;
function onLoaded(evt:Event):void {
trace("here we get the data back: "+myLoader.data);
}
myLoader.addEventListener(Event.COMPLETE, onLoaded);
myLoader.load(myRequest);





