FLASH部分:留言列表
| function showPage()//定义函数 { function titlemenu() { gbtitle.attachMovie("title_mc", "title_mc" + i, i);//循环增加MC gbtitle["title_mc" + i]._y = 30 * i;//MC的位置 gbtitle["title_mc" + i].page_id = gb[i].attributes.page_id;//title_mc里面 的动态文本显示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;//共几个节点-共几条记录 var nInterval = setInterval(titlemenu, 50);//延迟加载 this.createEmptyMovieClip("gbtitle", 1);//创建空的mc gbtitle._x = 10; gbtitle._y = 70; var i = 0; } // End function stop(); pageXML = new XML();//创建对象 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 = "正在加载数据,请等待..."; //_root.xiaoxikuang.gotoAndPlay("wu"); //_root.jindutiao.gotoAndPlay("wu"); //gotoAndPlay(76); } else { gotoAndPlay("error"); //如果加载失败 _root.xiaoxikuang.xiaoxi = "无法连接到数据库,请检测网络连接"; } // end if };// end function |
读取单条纪录
| gbtitle.removeMovieClip();//卸载留言列表 _global.zhen="read"; function Page(index) { //把asp传来的变量传给动态文本 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 = "发表时间:"+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 = "正在加载数据,请等待..."; read = showXML.firstChild.childNodes; Total = read.length; Page(0); gotoAndPlay(79); } else { gotoAndPlay("error"); //如果加载失败 _root.xiaoxikuang.xiaoxi = "无法连接到数据库,请检测网络连接"; } // end if };// end function |
写纪录
| function sendData() { //把动态文本里的内容传给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 = "留言内容不能为空!"; 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里面,但是因为我正在工作,没有时间,所以就做了一个简单的留言本!
海尔奥运滑轮广
童年的天地flas
flash开门效果
城市夜景flash
清静安宁的树林
我们未来的方向