AS3传递和获取数据的ASP数据、ASP

由网友(错过了那些错过)分享简介:我一直在研究有关issude天,但到现在我还是天堂找到一个解决办法。我对ASP 0知识。而我只是想能够通过从ASP获得VAR /文本。任何一种ENUFF来指导我怎样才能从这里furthur?私有函数loadASP():无效{VAR aspSend:的URLRequest =新的URLRequest(testASP....

我一直在研究有关issude天,但到现在我还是天堂找到一个解决办法。 我对ASP 0知识。而我只是想能够通过从ASP获得VAR /文本。

任何一种ENUFF来指导我怎样才能从这里furthur?

 私有函数loadASP():无效{
VAR aspSend:的URLRequest =新的URLRequest(testASP.asp);
VAR aspLoader:的URLLoader =新的URLLoader();

aspLoader.load(aspSend);

跟踪(做派);
//aspLoader.addEventListener(Event.COMPLETE,processASP);
}

私有函数processASP(五:事件):无效{
}
 

解决方案

你为什么要评论调用的addEventListener 的方法?取消注释它(和移动两行,以便它涉及的负荷调用之前)。如果URL是正确的,当响应到达(在真实生活中的应用的 processASP 方法将被调用,确保您监听ioError在和的securityError上的URLLoader - 检查这样的链接的例子)。你可以阅读 processASP 方法的响应, e.target.data 。

 私有函数processASP(五:事件):无效
{
  VAR装载机:的URLLoader =的URLLoader(e.target);
  跟踪(回答是+ loader.data);
}
 

的URLLoader ,也可以用于将数据发送到ASP页(服务器)。

  VAR LDR:的URLLoader =新的URLLoader();
VAR数据:使用URLVariables =新的URLVariables();
data.something =someData;
data.somethingElse =MOREDATA;
VAR要求:的URLRequest =新的URLRequest(url.asp);
request.data =数据;
request.method = URLRequestMethod.POST; //或GET
ldr.addEventListener(引发Event.COMPLETE,的onLoad);
//监听其他事件
ldr.load(要求);
 
asp 网页checkbox 参数传递问题

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 {
	}

解决方案

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