欧美日韩精品在线,国内精品久久久久久久久,一级毛片恃级毛片直播,清纯唯美亚洲综合欧美色

flash asp xml留言本教程_Flash教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:Flash教程:一個水波效果
主要使用了遮罩和beginGradientFill來實現(xiàn),對機器要求比較高,機器不是很好的朋友慎狂點...點擊查看Flash:http://tinsgao.googlepages.com/wave.swf主要代碼

在下載到本地或者上傳到空間上之前,請到后臺修改參數(shù)設(shè)置里面的地址,然后進行測試!
假如你的機器或者服務(wù)器不支持FSO,請手動修改URL.XML文件里面的地址!

ASP主要部分: page.asp (傳給flash第n頁的n條紀錄)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% show_page = 9 ’每頁顯示的紀錄
db = "data/data.mdb" ’數(shù)據(jù)庫存放目錄
’-連接數(shù)據(jù)庫
set conn=server.createobject("adodb.connection")
conn.open "driver=;dbq="&server.mappath(db)
’-----------------------------------------------------------------------
’用途:將UTF-8編碼漢字轉(zhuǎn)為GB2312碼,兼容英文和數(shù)字!
function encodestr(str)
dim i
str=trim(str)
str=replace(str,"’","""")
str=replace(str,vbCrLf&vbCrlf,"</p><p>")
encodestr=replace(str,vbCrLf,"<br>")
end function
’用途:將UTF-8編碼漢字轉(zhuǎn)為GB2312碼,兼容英文和數(shù)字!
Function uni(Chinese)
For j = 1 to Len (Chinese)
a=Mid(Chinese, j, 1)
uni= uni & "&#x" & Hex(Ascw(a)) & ";"
next
End Function %>
<%
’假如FLASH傳過來變量
if request("action")="showpage" then
’打開紀錄
sql="select * from gbook order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
’---------------分頁 開始
if not rs.eof then
’假如有記錄
rs.PageSize = show_page
total=rs.RecordCount ’共多少條記錄
maxpage=rs.PageCount ’共分幾頁
page=request("page") ’當前頁
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
else
’假如沒記錄
total=0
maxpage=0
page=0
out=""
wujilu="1"
’把wujilu變量傳給flash,讓flash知道沒有記錄然后做出相應(yīng)的動作
’輸出xml文件格式
Response.Write "<?xml version=’1.0’ encoding=’utf-8’?>"
Response.Write "<gbook total=’"&total&"’ maxpage=’"&maxpage&"’ page=’
"&page&"’ wujilu=’"&wujilu&"’></gbook>"
Session.CodePage="936"
end if
’---------------分頁 結(jié)束
’---------------打開 PageSize 條記錄 開始
if not rs.eof then
’假如有記錄
for i=1 to rs.PageSize
page_id=rs("id")
page_name=uni(rs("name"))
if len(rs("title")) > 19 then ’截取字符
page_title=left(rs("title"),19)&".."’截取字符
else
page_title=rs("title")
end if
page_title=uni(page_title)
page_date=rs("date")
out=out&"<info page_id=’"&page_id&"’ page_name=’"&page_name&"’ page_title=’
"&page_title&"’ page_date=’"&page_date&"’ />"
rs.movenext
if rs.EOF then
i=i 1
Exit For
end if
next
end if
’---------------打開 PageSize 條記錄 結(jié)束
rs.close
set rs=nothing
conn.close
set conn=nothing’釋放資源
’輸出分頁信息,xml格式
Response.Write "<?xml version=’1.0’ encoding=’utf-8’?>"
Response.Write "<gbook total=’"&total&"’ maxpage=’"&maxpage&"’
page=’"&page&"’>"&out&"</gbook>"
Session.CodePage="936"
end if
%>

show.asp(傳給flash單條紀錄的信息)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
show_page = 9 ’每頁顯示的紀錄
db = "data/data.mdb" ’數(shù)據(jù)庫存放目錄
set conn=server.createobject("adodb.connection")
conn.open "driver=;dbq="&server.mappath(db)
’-----------------------------------------------------------------------
’用途:將UTF-8編碼漢字轉(zhuǎn)為GB2312碼,兼容英文和數(shù)字!
function encodestr(str)
dim i
str=trim(str)
str=replace(str,"’","""")
str=replace(str,vbCrLf&vbCrlf,"</p><p>")
encodestr=replace(str,vbCrLf,"<br>")
end function
Function uni(Chinese)
For j = 1 to Len (Chinese)
a=Mid(Chinese, j, 1)
uni= uni & "&#x" & Hex(Ascw(a)) & ";"
next
End Function
’------------------------------------------------------------
%>
<%
if request("action")="show" then
’打開紀錄為flash傳過來的第show_id條信息
sql="select * from gbook where id="&request("show_id")
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
’uni參數(shù),就是把gb編碼轉(zhuǎn)換成utf-8編碼,要不然flash會亂碼
show_name=uni(rs("name"))
show_id=uni(rs("id"))
show_title=uni(rs("title"))
if rs("email")<>"" then
show_email=uni(rs("email"))
end if
if rs("qq")<>"" then
show_qq=uni(rs("qq"))
end if
show_content=uni(rs("content"))
show_date=uni(rs("date"))
out=out&"<info show_name=’"&show_name&"’ show_id=’"&show_id&"’
show_title=’"&show_title&"’ show_email=’"&show_email&"’ show_qq=’
"&show_qq&"’ show_content=’"&show_content&"’ show_date=’"&show_date&"’ />"
rs.close
set rs=nothing
conn.close
set conn=nothing
’輸出xml格式
Response.Write "<?xml version=’1.0’ encoding=’utf-8’?>"
Response.Write "<gbook>"&out&"</gbook>"
end if
%>

add.asp(flash傳給asp增加紀錄)

<%
show_page = 9 ’每頁顯示的紀錄
db = "data/data.mdb" ’數(shù)據(jù)庫存放目錄
set conn=server.createobject("adodb.connection")
conn.open "driver=;dbq="&server.mappath(db)
’-----------------------------------------------------------------------
’用途:將UTF-8編碼漢字轉(zhuǎn)為GB2312碼,兼容英文和數(shù)字!
function encodestr(str)
dim i
str=trim(str)
str=replace(str,"’","""")
str=replace(str,vbCrLf&vbCrlf,"</p><p>")
encodestr=replace(str,vbCrLf,"<br>")
end function
Function uni(Chinese)
For j = 1 to Len (Chinese)
a=Mid(Chinese, j, 1)
uni= uni & "&#x" & Hex(Ascw(a)) & ";"
next
End Function
’------------------------------------------------------------
%>
<%
Session.CodePage="65001"
if encodestr(request("action"))="add" then’假如flash傳過來的變量是add
if encodestr(request("w_name"))="" then’假如w_name等于空
cuowu="n"
response.write"&addok=" cuowu ’
elseif encodestr(request("w_title"))="" then ’假如標題空
cuowu="t"
response.write"&addok=" cuowu
elseif encodestr(request("w_content"))="" then’假如留言內(nèi)容空
cuowu="c"
response.write"&addok=" cuowu
end if
if cuowu="" then ’假如姓名,標題,留言內(nèi)容不為空
sql="select * from gbook "
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,3
rs.addnew ’增加紀錄
rs("name")=encodestr(request("w_name"))
rs("title")=encodestr(request("w_title"))
if encodestr(request("w_email"))="" then
rs("email")=null
else
rs("email")=encodestr(request("w_email"))
end if
if encodestr(request("w_qq"))="" then
rs("qq")=null
else
rs("qq")=encodestr(request("w_qq"))
end if
rs("content")=encodestr(request("w_content"))
rs("date")=date()
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"&addok=ok" ’返回給flash 留言成功
end if
end if
Session.CodePage="936"
%>

FLASH部分:
留言列表

function showPage()//定義函數(shù)
{
function titlemenu()
{
gbtitle.attachMovie("title_mc", "title_mc" i, i);//循環(huán)增加MC
gbtitle["title_mc" i]._y = 30 * i;//MC的位置
gbtitle["title_mc" i].page_id = gb[i].attributes.page_id;//title_mc里面
的動態(tài)文本顯示asp傳來的變量
page_id=gb[i].attributes.page_id;
gbtitle["title_mc" i].page_title = gb[i].attributes.page_title;
gbtitle["title_mc" i].page_date = gb[i].attributes.page_date;
gbtitle["title_mc" i].page_name = gb[i].attributes.page_name;
i ;
if (i >= nTotal)//假如紀錄大于每頁顯示的紀錄
{
clearInterval(nInterval);
} // end if
} // End function
total= pageXML.firstChild.attributes.total;
maxpage = pageXML.firstChild.attributes.maxpage;
page = pageXML.firstChild.attributes.page;
tPage = "第 " page " / " maxpage " 頁 共 " total " 條留言";
gb = pageXML.firstChild.childNodes;
nTotal = gb.length;//共幾個節(jié)點-共幾條記錄
var nInterval = setInterval(titlemenu, 50);//延遲加載
this.createEmptyMovieClip("gbtitle", 1);//創(chuàng)建空的mc
gbtitle._x = 10;
gbtitle._y = 70;
var i = 0;
} // End function
stop();
pageXML = new XML();//創(chuàng)建對象
pageXML.ignoreWhite = true;//忽略空格
pageXML.load(gbookurl "page.asp?action=showpage&page=" page "&temp="
Math.random() * Number(getTimer()));
pageXML.onLoad = function (success)
{
if (success)//假如讀取成功
{
showPage(1);
//假如加載成功
//xiaoxi = "正在加載數(shù)據(jù),請等待...";
//_root.xiaoxikuang.gotoAndPlay("wu");
//_root.jindutiao.gotoAndPlay("wu");
//gotoAndPlay(76);
}
else
{
gotoAndPlay("error");
//假如加載失敗
_root.xiaoxikuang.xiaoxi = "無法連接到數(shù)據(jù)庫,請檢測網(wǎng)絡(luò)連接";
} // end if
};// end function

讀取單條紀錄

gbtitle.removeMovieClip();//卸載留言列表
_global.zhen="read";
function Page(index)
{
//把asp傳來的變量傳給動態(tài)文本
show_id = "ID:" read[index].attributes.show_id;
show_name = "留言者:" read[index].attributes.show_name;
show_title = "標題:" read[index].attributes.show_title;
show_qq = "QQ:" read[index].attributes.show_qq;
show_email = "E-mail:" read[index].attributes.show_email;
show_content = read[index].attributes.show_content;
show_date = "發(fā)表時間:" read[index].attributes.show_date;
} // End function
showXML = new XML();
showXML.ignoreWhite = true;
showXML.load(gbookurl "show.asp?action=show&show_id=" go_id "&temp="
Math.random() * Number(getTimer()));
showXML.onLoad = function (success)
{
if (success)
{
//假如加載成功
_root.xiaoxikuang.xiaoxi = "正在加載數(shù)據(jù),請等待...";
read = showXML.firstChild.childNodes;
Total = read.length;
Page(0);
gotoAndPlay(79);
}
else
{
gotoAndPlay("error");
//假如加載失敗
_root.xiaoxikuang.xiaoxi = "無法連接到數(shù)據(jù)庫,請檢測網(wǎng)絡(luò)連接";
} // end if
};// end function

寫紀錄

function sendData()
{
//把動態(tài)文本里的內(nèi)容傳給send_var
send_var.w_name = _root.w_name;
send_var.w_qq = _root.w_qq;
send_var.w_email = _root.w_email;
send_var.w_title = _root.w_title;
send_var.w_content = _root.w_content;
send_var.sendAndLoad(gbookurl "add.asp?action=add", load_var, "post");
} // End of the function
send_var = new LoadVars();
load_var = new LoadVars();
fabiao.onRelease = sendData;
load_var.onLoad = function ()
{
if (this.addok=="ok")
{
_root.xiaoxikuang.xiaoxi = "留言成功!";
gotoAndPlay("wok");
}
if (this.addok=="n")
{
_root.xiaoxikuang.xiaoxi = "姓名不能為空!";
gotoAndPlay("werror");
}
if (this.addok=="t")
{
_root.xiaoxikuang.xiaoxi = "標題不能為空!";
gotoAndPlay("werror");
}
if (this.addok=="c")
{
_root.xiaoxikuang.xiaoxi = "留言內(nèi)容不能為空!";
gotoAndPlay("werror");
}
};//end load_var fun
chongzhi.onRelease = function() //重置按鈕
{
_root.w_name = "";
_root.w_qq = "";
_root.w_email = "";
_root.w_title = "";
_root.w_content = "";
}
stop();

主要用到的代碼就這些,還可以把后臺治理功能加在flash里面,但是因為我正在工作,沒有時間,所以就做了一個簡單的留言本!

分享:Flash制作鼠標滑過文字產(chǎn)生光效果動畫
效果:學(xué)習鼠標劃過文字產(chǎn)生的特效。01、新建flash文檔,背景色:645646,幀頻30,大小:150*50。02、【文件】【導(dǎo)入】【導(dǎo)入到舞臺】導(dǎo)入一幅位圖。(原文

來源:閃吧//所屬分類:Flash教程/更新時間:2008-03-05
相關(guān)Flash教程