Jump to content
Search Community

What if I need to send variables to the server along with my request in a loader?


GreenSock test

The first parameter of the various loaders (ImageLoader, XMLLoader, SWFLoader, MP3Loader, etc.) accepts either a simple String URL or a URLRequest. So if you want to pass data to the server, simply construct a URLRequest accordingly, like:

var request:URLRequest = new URLRequest("http://www.yourDomain.com/whatever.php");
var data:URLVariables = new URLVariables();
data.exampleSessionId = new Date().getTime();
data.exampleUserLabel = "label1";
request.data = data;
request.method = URLRequestMethod.POST;
var loader:ImageLoader = new ImageLoader(request, {name:"image1"});




×
×
  • Create New...