如何发送在AS3 GET请求? [英] How to send a GET request in AS3?
问题描述
我看到这样的例子在这里:<一href="http://damn.ihateblue.net/2011/09/24/actionscript-3-send-getpost/">http://damn.ihateblue.net/2011/09/24/actionscript-3-send-getpost/
I see this example here: http://damn.ihateblue.net/2011/09/24/actionscript-3-send-getpost/
它看起来pretty的好。但装载机似乎过于复杂。如果我不需要听一个回应?可以这样简单?
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?
推荐答案
如果你不想听的回应,那么你可以删除DATAFORMAT,监听器和它的处理函数。你也可以离开了 request.method
,因为GET是默认的。
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);
如果你不想发送任何数据以及您的要求,您还可以省略中央code座。
If you don't want to send any data along with your request you can also omit the central code block.
这篇关于如何发送在AS3 GET请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!