Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a GET request in AS3?

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

Which looks pretty good. But the loader seems overly complicated. What if I don't need to listen for a response? Can this be simplified?

like image 581
Andy Hin Avatar asked Jan 05 '12 17:01

Andy Hin


1 Answers

If you don't want to listen for a response then you can remove the dataFormat, the listener and its handler function. You can also leave out the request.method because GET is the 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 don't want to send any data along with your request you can also omit the central code block.

like image 156
shanethehat Avatar answered Nov 15 '22 05:11

shanethehat