ASPServices – Flash Remoting for ASP
March 13, 2005 at 8:13 pm | Technology | No comment
ASPServices是我自己开发的一个Flash和ASP互动的一个程序,因为是第一个版本所以可以功能不是很完善。不过可以做过FLASH和数据库的互动。
程序有两个部分一个FLASH的MXP包,一个是function.asp(ASP服务器的文件)
ASPServices配置:
首先要在FLASH上装中ASPServices双击ASPServices.mxp。
然后将function.asp放在你的虚拟主机中。
接下来就是应用了:
下在是FLASH里的代码
if (install != true) {
asp = new ASPServices();
asp.setDebug(true);
asp.setDefaultGatewayUrl("http://localhost/asp/dataxml");//在这里写上你的dataxml.asp地址不给后面的.asp
install = true;
}
obj = new Object();
obj.database = "select * from news";
asp.setService("getOne");
asp.setService("getAll",obj);
function getAll_result(result) {
grid1.dataProvider = result;
}
function getOne_result(result) {
trace(result);
}
在dataxml.asp中的代码如下
注意的是先要载入数据连接CONN
<%@ LANGUAGE = VBScript.Encode %>
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<%
function getAll()
sqlString = getVar("database")
set rs= conn.Execute(sqlString)
result(rs)
rs.close
end function
function getOne()
dd="rs"
result(dd)
end function
conn.close
%>
好了程序可以用了,你试试,这个是一个简单的教程。
下载包中有代码
ASPServices