asp教程写的,需要在iis环境下测试。在ied环境下硬整肯定是没有效果的(把后台拿来直接干的朋友点多,哈哈,所以提前说一下。 )
asp代码
代码:
<%@language="vbscrīpt" codepage="65001"%>
<%
dim a,b,ans
a=cint(request.form("a"))
b=cint(request.form("b"))
ans=a+b
response.write("")
response.contenttype = "text/xml"
response.write("")
response.end()
%>
flash代码
代码:
//----------------------urlrequest--------------------
var send_urlrequest:urlrequest =new urlrequest();
send_urlrequest.url="flash023.asp";
send_urlrequest.method=urlrequestmethod.post ;
//----------------------data载体---------------------
var data_urlvariables:urlvariables =new urlvariables;
data_urlvariables["a"]=26;
data_urlvariables["b"]=100;
send_urlrequest.data=data_urlvariables;
//-----------------------xml------------------------
var load_xml:xml;
//----------------------urlloader--------------------
var handler_loader:urlloader =new urlloader;
handler_loader.addeventlistener(event.complete ,onloadcompletehandler);
function onloadcompletehandler(_evt:event):void {
load_xml=xml(_evt.target.data);
show_txt.text =load_xml;
show_txt.appendtext("其中返回的得数是:"+load_xml.ans);
}
try {
handler_loader.load(send_urlrequest);
} catch (_err:error) {
trace(_err);
}
//--------------------创建一个用于显示的textfield----------------
var show_txt:textfield =new textfield;
show_txt.multiline =show_txt.wordwrap =true;
show_txt.width =show_txt.;
show_txt.x=75;
addchild(show_txt);