Home » 2009 » April » 16 » flash留言本制作|制作方法
5:09 PM
flash留言本制作|制作方法
flash留言本|flash留言本制作|制作方法

flash 2.0 演示地址:http://www.stonemx.com/design/flashgbook/2/

flash 1.0 演示地址:http://www.stonemx.com/design/flashgbook/1/

flash2.0下载: http://www.stonemx.com/design/flashgbook/flashgbook20.rar

flash1.0下载: http://www.stonemx.com/design/flashgbook/flashgbook10.rar

flash2.0(exe文件)http://www.stonemx.com/design/flashgbook/gbook.rar(可以做电子杂志的留言系统 )

提示:如果无法留言,请关闭拦截功能 ,例如 网上助手 等

很多朋友都说乱码和无法留言的问题
1,请检查flash浏览器版本
2.请检查机器编码是否是 中文简体

安装说明
在使用之前,确定空间或者本地测试服务器是否支持asp,及正常运行asp

不会iis的朋友看看这里
http://www.stonemx.com/blog/archives/2006/iis.html
//////////////////////////////////////////////////////////////////////////
后台登陆地址 flashgbook/admin/index.asp
用户名 admin
密  码 admin
//////////////////////////////////////////////////////////////////////////

----------------背景图片--------------------------

flashgbook/images/bg.jpg   788x430像素,可以后台上传,也可以手动覆盖!
---------------------------------------------------------------------

----------------安全设置)---------------------------
(这里不是必须修改的,如果你对iis及路径不是十分了解,建议不要修改,跳过1.2步)
1.下载后请更改数据库(flashgbook/data/data.mdb)名称   例如(flashgbook/data/stone.asp)

2.用记事本打开(flashgbook/data.asp)修改数据库名称    例如(dbname="stone.asp")

3.登陆后台 修改用户名和密码
----------------------------------------------

关于外部flash加载留言本问题! 桢设置为40,要不会出现停顿现象!
使用loadMovie("flashgbook.swf",0);或者gbook_mc.loadMovie("flashgbook.swf");



ASP主要部分:

(转载请注明出处和作者,谢谢!)

page.asp (传给flash第n页的n条纪录)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#i nclude file="conn.asp"-->
<%
if request("action")="showpage" then
dim idcount'记录总数
dim pages'每页条数
dim pagec'总页数
dim page'页码
dim datafrom'数据表名
dim taxis'排序的语句
'-------------------设置参数开始---------------------------------

'taxis="order by id asc" '正排序
taxis="order by pxid desc,id desc" '倒排序
pages=show_page'每页条数
datafrom="gbook"'数据表名

page=clng(request("page"))


'-------------------设置参数结束---------------------------------
dim pagenmax '每页显示的分页的最大页码
dim pagenmin '每页显示的分页的最小页码
dim sqlid'本页需要用到的id
dim i'用于循环的整数

'获取记录总数
sql="select count(id) as idcount from ["& datafrom &"]"

set rs=server.createobject("adodb.recordset")
rs.open sql,conn,0,1

idcount=rs("idcount")'获取记录总数

if(idcount>0) then'如果记录总数=0,则不处理
if(idcount mod pages=0)then'如果记录总数除以每页条数有余数,则=记录总数/每页条数+1
pagec=int(idcount/pages)'获取总页数
else
pagec=int(idcount/pages)+1'获取总页数
end if

'获取本页需要用到的id============================================
'读取所有记录的id数值,因为只有id所以速度很快
sql="select id from ["& datafrom &"] " & taxis

set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1

rs.pagesize = pages '每页显示记录数
if page < 1 then page = 1
if page > pagec then page = pagec
if pagec > 0 then rs.absolutepage = page

for i=1 to rs.pagesize
if rs.eof then exit for
if(i=1)then
sqlid=rs("id")
else
sqlid=sqlid &","&rs("id")
end if
rs.movenext
next
'获取本页需要用到的id结束============================================
end if
%>
<%
if(idcount>0 and sqlid<>"") then'如果记录总数=0,则不处理
'用in刷选本页所语言的数据,仅读取本页所需的数据,所以速度快
sql="select [id],[title],[name],[date] from ["& datafrom &"] where id in("& sqlid &")"&taxis
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,0,1
while(not rs.eof)'填充数据到表格
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_email=rs("email")
'page_qq=rs("qq")

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
wend
rs.close
set rs=nothing
Response.Write ""
Response.Write "<gbook total='"&idcount&"' maxpage='"&pagec&"' page='"&page&"'>"&out&"</gbook>"
Session.CodePage="936"

else
total=0
maxpage=0
page=0
out=""
wujilu="1"
Response.Write ""
Response.Write "<gbook total='"&total&"' maxpage='"&maxpage&"' page='"&page&"' wujilu='"&wujilu&"'></gbook>"
Session.CodePage="936"
end if
end if'end action showpage
%>




show.asp(传给flash单条纪录的信息)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#i nclude file="conn.asp"-->
<%
if request("action")="show" then
sql="select * from gbook where id in("&request("show_id")&")"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
show_name=uni(rs("name"))
show_id=uni(rs("id"))
show_title=uni(rs("title"))

if rs("blog")<>"" then
show_blog=uni(rs("blog"))
end if
if rs("homepage")<>"" then
show_homepage=uni(rs("homepage"))
end if
if rs("gmcontent")<>"" then
show_gmcontent=uni(rs("gmcontent"))
end if
if rs("gmdate")<>"" then
show_gmdate=uni(rs("gmdate"))
end if

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_blog='"&show_blog&"' show_homepage='"&show_homepage&"' show_gmcontent='"&show_gmcontent&"' show_gmdate='"&show_gmdate&"' 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
Response.Write ""
Response.Write "<gbook>"&out&"</gbook>"
end if
%>

add.asp(flash传给asp增加纪录)

<!--#i nclude file="conn.asp"-->
<%
Session.CodePage="65001"
if request("action")="add" then
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_homepage"))="" then
rs("homepage")=null
else
rs("homepage")=encodestr(request("w_homepage"))
end if

if encodestr(request("w_blog"))="" then
rs("blog")=null
else
rs("blog")=encodestr(request("w_blog"))
end if

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
response.write"&addok=ok"
end if
Session.CodePage="936"
%>


FLASH部分

留言列表

function showPage() {
function titlemenu() {
gbtitle.attachMovie("title_mc", "title_mc"+i, i);
gbtitle["title_mc"+i]._y = 30*i;
gbtitle["title_mc"+i].page_id = gb[i].attributes.page_id;
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);
}
}
total = pageXML.firstChild.attributes.total;
maxpage = pageXML.firstChild.attributes.maxpage;
page = pageXML.firstChild.attributes.page;
tPage = "共 "+total+" 条留言 当前第 "+page+" 页 共 "+maxpage+" 页";
gb = pageXML.firstChild.childNodes;
nTotal = gb.length;
var nInterval = setInterval(titlemenu, 50);
this.createEmptyMovieClip("gbtitle", 1);
gbtitle._x = 8;
gbtitle._y = 8;
var i = 0;
}
stop();
pageXML = new XML();
pageXML.ignoreWhite = true;
pageXML.load("flashgbook/inc/page.asp?action=showpage&page="+1+"&temp="+Math.random()*Number(getTimer()));
//temp= 作用刷新记录
pageXML.onLoad = function(success) {
if (success) {
if (pageXML.firstChild.attributes.wujilu == "1") {
xiaoxi = "还没有留言..";
randw.gotoAndPlay("gow");
} else {
//xiaoxi = "读取数据中..";
gotoAndPlay(3);
}
} else {
xiaoxi = "加载错误...";
}
// end if
};
//end onload


读取单条纪录

function Page(index) {
show_id = read[index].attributes.show_id;
show_name = read[index].attributes.show_name;
show_blog = read[index].attributes.show_blog;
show_homepage = read[index].attributes.show_homepage;
show_gmcontent.htmlText = read[index].attributes.show_gmcontent;
show_gmdate = read[index].attributes.show_gmdate;
show_title = read[index].attributes.show_title;
show_qq = read[index].attributes.show_qq;
show_email = read[index].attributes.show_email;
show_content = read[index].attributes.show_content;
show_date = read[index].attributes.show_date;
}
// End function
showXML = new XML();
showXML.ignoreWhite = true;
showXML.load("flashgbook/inc/show.asp?action=show&show_id="+go_id+"&temp="+Math.random()*Number(getTimer()));
showXML.onLoad = function(success) {
if (success) {
//如果加载成功
xiaoxi2 = "LOADING XML";
read = showXML.firstChild.childNodes;
Total = read.length;
gotoAndPlay("readok");
} else {
//gotoAndPlay("error");
//如果加载失败
xiaoxi2 = "读取错误...";
}
// end if
};
// end function
stop();


写纪录

fabiao.onRelease = function() {
//
};
send_var = new LoadVars();
load_var = new LoadVars();
if (show_blog == undefined) {
show_blog = "";
}
if (show_homepage == undefined) {
show_homepage = "";
}
if (show_gmcontent == undefined) {
show_gmcontent = "";
}
if (show_gmdate == undefined) {
show_gmdate = "";
}
if (show_qq == undefined) {
show_qq = "";
}
if (show_email == undefined) {
show_email = "";
}
send_var.w_name = w_name;
send_var.w_qq = w_qq;
send_var.w_blog = w_blog;
send_var.w_homepage = w_homepage;
send_var.w_email = w_email;
send_var.w_title = w_title;
send_var.w_content = w_content;
trace(w_name);
trace(w_qq);
trace(w_blog);
trace(w_homepage);
trace(w_email);
trace(w_title);
trace(w_content);
send_var.sendAndLoad("flashgbook/inc/add.asp?action=add&temp="+Math.random()*Number(getTimer()), load_var, "post");
load_var.onLoad = function(success) {
if (success) {
if (this.addok == "ok") {
xiaoxi2 = "留言成功...";
gotoAndPlay("writeok");
} else {
gotoAndStop("nowrite");
}
}
};
//end load_var fun
stop();
Views: 853 | Added by: ystyle | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Sign Up | Log In ]