Hi

I'd proposed a change for URLLoader to allow you to post binary data [1], but 
actually there's already a class "URLBinaryLoader" which had this functionality 
already... so probably we need to create a similar class, "URLVariablesLoader" 
perhaps.

For the URLVariables class, it looks like this isn't implemented yet, but it 
should be fairly straightforward as all you need to do is url-encode the string 
and then the 'data' in your URL request can be set via the 'toString()' method, 
which I guess will need casting to an Object.

Worth looking at the documentation for the Flash version of URLVariables [2]; 
basically, you pass it your string (in the constructor or in the 'decode' 
method) and then the "toString()" method should return the URL-encoded string 
per the example in [2]. That string can just be used in the parameter that's 
passed in to the XMLHttpRequest 'send()' call - see the "post" example in [3].

Hope that helps!

thanks

    Andrew


[1] https://github.com/apache/royale-asjs/pull/345
[2] 
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLVariables.html
[3] https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send


-----Original Message-----
From: Olaf Krueger [mailto:[email protected]] 
Sent: 30 January 2019 08:23
To: [email protected]
Subject: [EXTERNAL] Re: URLRequest

Hi,
unfortunately, I am not sure about URLLoader.
But you may want to give HTTPService a try, something like this [1].
You should find some examples here anywhere [2].

Maybe this helps,
Olaf

[1]
var service:HTTPService = new HTTPService(); service.url = "..."; 
service.method = "POST";

//var header:HTTPHeader = new HTTPHeader(...); //service.contentType = "..."; 
//service.headers = new Array(header);

service.contentData = "...";
service.addEventListener("complete", onComplete); 
service.addEventListener("ioError", onFault); service.send();

[2]
https://clicktime.symantec.com/3XDYEYEvRP6yiHaXvjgdzx77Vc?u=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Ftree%2Fdevelop%2Fexamples%2Froyale



--
Sent from: 
https://clicktime.symantec.com/37Ro7ZbXBwWL17uhQUQPE6v7Vc?u=http%3A%2F%2Fapache-royale-development.20373.n8.nabble.com%2F

Reply via email to