AS3 Passing and getting data to ASP

前端 未结 1 741
感情败类
感情败类 2020-12-03 23:36

I\'ve been researching for days on the issude but till now I still haven found a solution yet. I have 0 knowledge on ASP. And I just want to able to pass and get var/text fr

相关标签:
1条回答
  • 2020-12-04 00:10

    Why have you commented the call to addEventListener method? Uncomment it (and move it up two lines so that it comes before the load call). If the url is correct, the processASP method will be called when the response arrives (in a real life application, make sure you listen for ioError and securityError on the URLLoader - check the link for examples on doing this). You can read the response as e.target.data in the processASP method.

    private function processASP(e:Event):void 
    {
      var loader:URLLoader = URLLoader(e.target);
      trace("Response is " + loader.data);
    }
    

    URLLoader can also be used to send data to the asp page (server).

    var ldr:URLLoader = new URLLoader();
    var data:URLVariables = new URLVariables();
    data.something = "someData";
    data.somethingElse = "moreData";
    var request:URLRequest = new URLRequest("url.asp");
    request.data = data;
    request.method = URLRequestMethod.POST;//or GET
    ldr.addEventListener(Event.COMPLETE, onLoad);
    //listen for other events
    ldr.load(request);
    
    0 讨论(0)
提交回复
热议问题