flex3中LoadVars的等价物是什么?

时间:2010-12-11 15:28:01

标签: flex actionscript

    var lv = new LoadVars();
    var r = new LoadVars();
    lv.action = "update";
            r.onLoad = function(success) 
    {
                //do further logic here
            }
    lv.sendAndLoad("http://example.net/service.php", r, "POST");

如何在flex 3中执行上述操作?

更新

如何使用URLLoader ??

执行此操作

1 个答案:

答案 0 :(得分:3)

使用HTTPService

var vo:Object = new Object;
    vo.action = "update";
    s = new HTTPService();
    s.url = "http://example.net/service.php"
    s.method = "POST";
    s.resultFormat = "e4x"; //or xml or whatever
    s.send(vo);
    s.addEventListener(ResultEvent.RESULT,onLoad);

使用URLLoader

var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("url here");
var vars:URLVariables = new URLVariables();     
vars.action = "update";
request.data = vars;
request.method = URLRequestMethod.POST;
loader.load(request);
loader.addEventListener(Event.COMPLETE,onComplete);