Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash able to send http requests and retrieve response? 1

Status
Not open for further replies.

russland

Programmer
Jan 9, 2003
315
CH
unfortunately i haven't got flash remoting. but is it possible to request an ASP page and then read-in the response from it (the response would be an pure xml)?

short example?

thanks a lot.
 
Yes using the loadVars.sendAndLoad is probably the best way because you can monitor the transaction and then continue when the data has been received from the data file.

Here is an example:

Add these two functions to the first frame (actions layer) of your main timeline.

Code:
_global.sendInfo = function(){
	sendVars = new LoadVars();
	sendVars.email = _root.email_txt;

	ASPresponse = new LoadVars();
	ASPresponse.onLoad = _global.receiveReply;
	
	sendVars.sendAndLoad("[URL unfurl="true"]http://localhost/sendandload/processForm.asp",ASPresponse,"POST");[/URL]
}

_global.receiveReply = function(result){
   //in  your case the XML functions would go here
	if(result){
		_root.reply = ASPresponse.reply;
	}else{
		_root.reply = "Error";
	}
}

Then on a button ("Submit"?) add:

Code:
on(release){
   _global.sendInfo;
}

In the example I have an ASP page that is simply:

Code:
<%
'When flash sends
myBody = Request.Form()

'Return values to flash

Response.Write "&reply=Received "& myBody
%>

I can tell you how to use the XML connector component in MX 2004 Pro (if that is the version you are using) for your results. Otherwise you have to use the XML actionscript object (which I am not very familiar with).

BTW... Your results do not have to be in XML to be usable in Flash.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top