How to send a GET request to AS3?

Here I see this example: http://damn.ihateblue.net/2011/09/24/actionscript-3-send-getpost/

Which looks pretty good. But the bootloader seems too complicated. What if I don’t need to listen to the answer? Can this be simplified?

+6
source share
1 answer

If you do not want to listen to the answer, you can remove the dataFormat function, the listener, and the handler function. You can also leave request.method , because GET is by default.

 import flash.net.*; var url:String = "http://192.168.1.1:1234/"; var request:URLRequest = new URLRequest(url); var variables:URLVariables = new URLVariables(); variables.name = "Anton Ashardi"; request.data = variables; var loader:URLLoader = new URLLoader(); loader.load(request); 

If you do not want to send any data along with your request, you can also omit the central block of code.

+5
source

Source: https://habr.com/ru/post/905220/


All Articles