Question

I have send parameters for my backend in PHP but i have code and i not send parameters look

var request:URLRequest = new URLRequest(modelLocator.CaminhoServidor+"AnexoDocumentos_Financeiro/asdas/xml.php");
            var loader:URLLoader = new URLLoader();
            loader.dataFormat = URLLoaderDataFormat.VARIABLES;
            request.data = Remessa;
            request.method = URLRequestMethod.POST;
            loader.addEventListener(Event.COMPLETE, RecebeXML);
            loader.load(request);

how send 3 parameters this code?

Was it helpful?

Solution

You need to use the 'variables' field in the URLRequest object:

var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.param1 = ...
variables.param2 = ...
variables.param3 = ...
request.data = variables;

var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, urlLoader_error);
urlLoader.load(request);

Also, it's a good idea to define handlers for errors (as shown for IO_ERROR above but also HTTP_STATUS and SECURITY_ERROR)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top