打印

[编程] 请教高手:一个分页显示的问题

我把这短代码放在根时间线上,可以正常的显示每页的数据,但是把它放在一个MC的时间线上就无法显示第一条数据了?请教一下到底是为什么,还有就是要是最后一页不足10条记录(正常的10条每页)它后几条记录会显示前页的后几条记录,怎样让它不显示前页的内容啊?
代码大致如下:
var page_num = 1;
up_btn.onRelease = function() {
       if (page_num>1) {
              page_num = page_num-1;
              var my_lv = new LoadVars();
              my_lv.onLoad = function(success) {
                     if (success) {
                            for (i=0; i<=this.count; i++) {
                                   var temp_mc = null_mc.attachMovie("liuyan_mc", "item"+i, i);
                                   temp_mc._y = i*20;
                                   temp_mc.title_txt.text = this["nc"+i];
                                   temp_mc.time_txt.text = this["t"+i];
                                   temp_mc.content_txt = this["nr"+i];
                                   temp_mc.reply_txt = this["reply"+i];
                                   temp_mc.onRelease = disinfo;
                            }
                     } else {
                            trace("加载出错!");
                     }
              };
              my_lv.load("read.asp?page="+page_num+"&"+"t="+Math.random(10000));
       } else {
              trace("出错了!");
       }
};
down_btn.onRelease = function() {
       page_num = page_num+1;
       var my_lv = new LoadVars();
       my_lv.onLoad = function(success) {
              if (success) {
                     for (i=0; i<=this.count; i++) {
                            var temp_mc = null_mc.attachMovie("liuyan_mc", "item"+i, i);
                            temp_mc._y = i*20;
                            temp_mc.title_txt.text = this["nc"+i];
                            temp_mc.time_txt.text = this["t"+i];
                            temp_mc.content_txt = this["nr"+i];
                            temp_mc.reply_txt = this["reply"+i];
                            temp_mc.onRelease = disinfo;
                     }
              } else {
                     trace("加载出错!");
              }
       };
       my_lv.load("read.asp?page="+page_num+"&"+"t="+Math.random(10000));
};
content_mc._visible = false;
function disinfo() {
       null_mc._visible = false;
       up_btn._visible = false;
       down_btn._visible = false;
       content_mc._visible = true;
       content_mc.content_txt.text = this.content_txt;
       content_mc.reply_txt.text = this.reply_txt;
}
content_mc.close_btn.onRelease = function() {
       null_mc._visible = true;
       up_btn._visible = true;
       down_btn._visible = true;
       content_mc._visible = false;
       content_mc.content_txt.text = "";
};
var my_lv = new LoadVars();
my_lv.onLoad = function(success) {
       if (success) {
              for (i=0; i<=this.count; i++) {
                     var temp_mc = null_mc.attachMovie("liuyan_mc", "item"+i, i);
                     temp_mc._y = i*20;
                     temp_mc.title_txt.text = this["nc"+i];
                     temp_mc.time_txt.text = this["t"+i];
                     temp_mc.content_txt = this["nr"+i];
                     temp_mc.reply_txt = this["reply"+i];
                     temp_mc.onRelease = disinfo;
              }
       } else {
              trace("加载出错!");
       }
};
my_lv.load("read.asp?page="+page_num+"&"+"t="+Math.random(10000));

[ 本帖最后由 richan 于 2008-5-21 17:14 编辑 ]

TOP

那个大虾帮帮忙嘛!

TOP

每翻下一页,应该清除前一页.

TOP

敢问一下 是不是 用unloadmovie()
在什么时候去掉啊?

TOP

看看代码,学习学习编程技巧。

TOP