ASP部分:
<%
added=request("added")
del=request("del")
action=request.QueryString("action")
set conn=server.createObject ("adodb.connection")
set rs=server.createObject ("adodb.recordset")
dbpath=server.MapPath ("db1.mdb")
connstr="Driver={Microsoft Access Driver (*.mdb)};dbq="&dbpath
conn.Open connstr
if (action <> "add" and action <>"added") then
'下面是读取数据库信息部分
sql="select * from shu where id=1"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
else
Response.Write "a=" & (RS("number"))
response.Write "&eof=true"
end if
end if
%>
<%
'下面部分为删除按扭信息部分
if (action="add") then
sql="select * from shu where id=1"
rs.Open sql,conn,1,3
rs("number")=del
rs.update
response.write "ok=1"
rs.close
end if
%>
<%
'下面的部分是保存按扭信息部分
if (action="added") then
sql="select * from shu where id=1"
rs.Open sql,conn,1,3
rs("number")=added
rs.update
response.write "save=1"
rs.close
end if
%>
FLASH部分:
第一部分是初始化变量:
eof = "false";
a=0; //按扭的初始数量
r = random(65500);
loadVariables("read.asp?action=" add r, "");//添加随机数的目的是防止不同浏览器不无法刷新变量的(不过可能是画蛇添足,哈哈)第9贞:
if (eof ne "true") {
gotoAndPlay("read");
}
判断是否读取数据成功!
第十贞:
a = Number(a);
if (a == 0 or a<0) {
a = 1;
for (i=1; i<=a; i++) {
_root.attachMovie("m"+i, "m"+i, i+1);
if (i<=5) {
eval("m"+i)._x = 200+i*eval("m"+i)._width;
eval("m"+i)._y = 200;
}
if (i>5 and i<=10) {
eval("m"+i)._x = i*eval("m"+i)._width-50;
eval("m"+i)._y = 250;
}
}
} else {
for (i=1; i<=a; i++) {
_root.attachMovie("m"+i, "m"+i, i+1);
if (i<=5) {
eval("m"+i)._x = 200+i*eval("m"+i)._width;
eval("m"+i)._y = 200;
}
if (i>5 and i<=10) {
eval("m"+i)._x = i*eval("m"+i)._width-50;
eval("m"+i)._y = 250;
}
}
}
stop();
//根据数据库中按扭数量"a"的大小添加按扭,并且以5*2的顺序进行排序!加载按扭:
on (release) {
if (a<=10 and a>=1) {
a =Number(a)+1;
trace(a);
_root.attachMovie("m"+a, "m"+a, a+1);
if (a<=5) {
eval("m"+a)._x = 200+a*eval("m"+a)._width;
eval("m"+a)._y = 200;
}
if (a>5 and a<=10) {
新闻热点
疑难解答