问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/8746670/how-to-send-a-get-request-in-as3