当前位置:软件学习 > Flash >>

flash实现_外部通信

flash实现_外部通信

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.height =400;
show_txt.x=75;
addChild(show_txt);
后台:
复制内容到剪贴板代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim a,b,ans
a=Cint(Request.Form("a"))
b=Cint(Request.Form("b"))
ans=a+b
Response.write("<?xml version=""1.0"" encoding=""utf-8""?>")
Response.ContentType = "text/XML"
Response.Write("<math>")
Response.Write("<a>"&a&"</a>")
Response.Write("<b>"&b&"</b>")
Response.Write("<ans>"&ans&"</ans>")
Response.Write("</math>")
Response.End()
%>

补充:flash教程,动画技术
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,