淘沙网留言版V1.0的制作教程及源码下载。
网上用FLASH制作的留言版很多很多。比如以前的befeeling、石头、etp等。。。让人看得眼花缭乱。而且写教程的也很多。最为经典的当数火山大虾的留言版教程。
淘沙网也给大家制作一个小巧的留言本吧。
地址:
http://www.taoshaw.com/taoshaw/study/studyguest/
功能说明:
1、FLASH文件长宽大小为300*365,比较小巧。适合放在网页中。
2、体积大小为64KB。如果不喜欢按钮音效的,可以去掉音效文件。又可以省下十几K。
3、后台可管理帐户。添加用户,修改资料等。
界面如下:
制作过程较为复制。下面把一些重要部分界面列出。
那,如上图所示。是库中元件的摆设方式。大家若有兴趣制作的。可以参考一下。
这是显示列表的时候的一些过程。。。
这是添加留言的布局方式。
我想的话,真正想学的朋友很少吧。大部分都是直接拿去修改。所以。在这里,就把源文件附后。欢迎下载。若有BUG的请留言。
这个留言版。参考了其他一些留言版的代码。呵呵。
发一些重要代码及注释:
//================版权声明开始================//
//★淘沙网:http://www.taoshaw.com
//★淘沙网所有教程欢迎转载。不过请转载时注明出处。谢谢合作。
//================版权声明结束================//
//去掉右键,以及添加右键
var my_con:ContextMenu = new ContextMenu();
//隐藏右键
my_con.hideBuiltInItems();
my_con.customItems.push(new ContextMenuItem("版权所有:淘沙网", menu_03));
this.menu = my_con;
//点击右键,打开淘沙网窗口
function menu_03() {
getURL("http://www.taoshaw.com", "_blank");
}
var switch_next_go;
//定义总页数
_global.total_page = 0;
//定义显示列表函数
//点下一页,往后翻页
function next_go() {
if (stage_status == "list") {
_global.page++;
block_btns();
show_list();
} else if (stage_status == "detail") {
_global.index++;
block_btns();
show_detail();
}
}
function last_go() {
if (stage_status == "list") {
_global.page = total_page;
block_btns();
show_list();
} else if (stage_status == "detail") {
_global.index = _global.read_book.count;
block_btns();
show_detail();
}
}
//定义前一页
function pre_go() {
if (stage_status == "list") {
_global.page--;
block_btns();
show_list();
} else if (stage_status == "detail") {
_global.index--;
block_btns();
show_detail();
}
}
//定义首页数据
function first_go() {
if (stage_status == "list") {
_global.page = 1;
block_btns();
show_list();
} else if (stage_status == "detail") {
_global.index = 1;
block_btns();
show_detail();
}
}
//默认显示列表
function show_list() {
with (list_show) {
//默认为11条每页
for (i=1; i<=11; i++) {
list_index = (_global.page-1)*11+i;
if (list_index<=_global.read_book.count) {
eval("b"+i)._visible = true;
eval("b"+i).x = list_index;
//为按钮添加函数,当点击时,运行显示详细信息方法
eval("b"+i).onPress = function() {
_global.index = this.x;
_root.switch_to_detail();
};
//显示标题信息
eval("l"+i).htmlText = _global.read_book["name"+list_index]+">> "+_global.read_book["title"+list_index];
if (_global.read_book["edit"+list_index] != null) {
eval("l"+i).htmlText = _global.read_book["edit"+list_index]+eval("l"+i).htmlText;
}
//这段可以不去理解,开始制作时,当有回复时。前面有一个小图标。后来界面不太美观。我已去掉。
if (_global.read_book["admin_name"+list_index] != null && _global.read_book["admin_name"+list_index] != 0) {
eval("m"+i)._visible = true;
} else {
eval("m"+i)._visible = false;
}
} else {
eval("b"+i)._visible = false;
eval("l"+i).text = "";
eval("m"+i)._visible = false;
}
}
}
}
function show_detail() {
if (_global.read_book["admin_name"+_global.index] == 0) {
login.block_delete_btn._visible = true;
login.block_edit_btn._visible = true;
login.block_reply_btn._visible = true;
}
with (detail) {
name_txt.htmlText = _global.read_book["name"+_global.index];
title_txt.htmlText = _global.read_book["title"+_global.index];
from_txt.htmlText = _global.read_book["from"+_global.index];
date_txt.htmlText = _global.read_book["date"+_global.index];
comments = _global.read_book["comments"+_global.index];
ip = _global.read_book["ip"+_global.index];
email = _global.read_book["email"+_global.index];
if (email != "" && email != null) {
email_btn.enabled = true;
email_btn._alpha = 100;
email_btn.onRollOver = function() {
iew._visible = true;
iew.msg = _global.read_book["email"+_global.index];
};
email_btn.onPress = function() {
getURL("mailto:"+_global.read_book["email"+_global.index]);
};
} else {
email_btn.enabled = false;
email_btn._alpha = 50;
}
if (_global.read_book["website"+_global.index] != "" && _global.read_book["website"+_global.index] != null) {
website_btn.enabled = true;
website_btn._alpha = 100;
website_btn.onRollOver = function() {
iew._visible = true;
iew.msg = _global.read_book["website"+_global.index];
};
//当主页按钮被点击时,打开页面。
website_btn.onPress = function() {
getURL(_global.read_book["website"+_global.index], "_blank");
};
} else {
website_btn.enabled = false;
website_btn._alpha = 50;
}
if (_global.read_book["hide_ip"+_global.index] == 0 || admin_name != null) {
ip_btn.onRollOver = function() {
iew._visible = true;
iew.msg = "IP: "+_global.read_book["ip"+_global.index];
};
} else {
ip_btn.onRollOver = function() {
iew._visible = true;
iew.msg = "IP: 已隐藏";
};
}
//显示内容,以及回复人及回复内容
if (_global.read_book["edit"+_global.index] != null) {
comments = "<p>"+_global.read_book["edit"+_global.index]+"</p>"+comments;
}
if (_global.read_book["admin_name"+_global.index] != null && _global.read_book["admin_name"+_global.index] != 0) {
comments += newline+newline+"<p><font color='#464646'>回复人:"+_global.read_book["admin_name"+_global.index]+" : </font></p><blockquote><font color='#464646'>"+_global.read_book["reply"+_global.index]+"</font></blockquote>";
}
comments_txt.html = true;
comments_txt.htmlText = comments;
if (comments_txt.maxscroll>1) {
up_btn._visible = true;
down_btn._visible = true;
} else {
up_btn._visible = false;
down_btn._visible = false;
}
}
}
//显示页面数量等信息
function block_btns() {
if (stage_status == "list") {
login.block_reply_btn._visible = true;
login.block_delete_btn._visible = true;
login.block_edit_btn._visible = true;
bottom.page_txt.text = _global.page+"/"+_global.total_page;
mid_bar.mid_arrow.enabled = true;
if (_global.page>=_global.total_page) {
block_next_last();
} else {
enable_next_last();
}
if (_global.page<=1) {
block_pre_first();
} else {
enable_pre_first();
}
} else if (stage_status == "detail") {
login.block_reply_btn._visible = false;
login.block_delete_btn._visible = false;
login.block_edit_btn._visible = false;
bottom.page_txt.text = _global.index+"/"+_global.read_book.count;
mid_bar.mid_arrow.enabled = true;
if (_global.index>=_global.read_book.count) {
block_next_last();
} else {
enable_next_last();
}
if (_global.index<=1) {
block_pre_first();
} else {
enable_pre_first();
}
} else {
login.block_reply_btn._visible = true;
login.block_delete_btn._visible = true;
login.block_edit_btn._visible = true;
bottom.page_txt.text = "***";
mid_bar.mid_arrow.enabled = false;
block_next_last();
block_pre_first();
}
if (stage_status == "add" || stage_status == "loading") {
bottom.add_btn._alpha = 50;
bottom.add_btn.enabled = false;
} else {
bottom.add_btn._alpha = 100;
bottom.add_btn.enabled = true;
}
}
function block_next_last() {
bottom.next_btn._alpha = 50;
bottom.next_btn.enabled = false;
bottom.last_btn._alpha = 50;
bottom.last_btn.enabled = false;
}
function block_pre_first() {
bottom.pre_btn._alpha = 50;
bottom.pre_btn.enabled = false;
bottom.first_btn._alpha = 50;
bottom.first_btn.enabled = false;
}
function enable_next_last() {
bottom.next_btn._alpha = 100;
bottom.next_btn.enabled = true;
bottom.last_btn._alpha = 100;
bottom.last_btn.enabled = true;
}
function enable_pre_first() {
bottom.pre_btn._alpha = 100;
bottom.pre_btn.enabled = true;
bottom.first_btn._alpha = 100;
bottom.first_btn.enabled = true;
}
//上面AD。
ad_Url_btn.onRelease = function():Void {
getURL("http://www.taoshaw.com", "_blank");
};
url_yinbwen.onRelease = function():Void {
getURL("http://www.taoshaw.com", "_blank");
};
源文件下载>>>