AS3 向 ASP 传递和获取数据 [英] AS3 Passing and getting data to ASP

查看:28
本文介绍了AS3 向 ASP 传递和获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这个问题上研究了好几天,但直到现在我仍然没有找到解决方案.我对 ASP 的了解为 0.我只想能够从 ASP 传递和获取 var/text.

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 from ASP.

有没有好心人指导我如何从这里走出来?

Anyone kind enuff to guide me how I can furthur from here?

private function loadASP():void {
        var aspSend:URLRequest=new URLRequest("testASP.asp");
        var aspLoader:URLLoader = new URLLoader();

        aspLoader.load(aspSend);

        trace("did send");
        //aspLoader.addEventListener(Event.COMPLETE, processASP);
    }

    private function processASP(e:Event):void {
    }

推荐答案

为什么要注释对 addEventListener 方法的调用?取消注释(并将其向上移动两行,使其出现在 load 调用之前).如果 url 正确,当响应到达时将调用 processASP 方法(在现实生活中的应用程序中,请确保您在 URLLoader - 检查链接以获取有关执行此操作的示例).您可以在 processASP 方法中将响应读取为 e.target.data.

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 也可以用来向asp页面(服务器)发送数据.


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);

这篇关于AS3 向 ASP 传递和获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆