五颜六色论坛 -> 网站建设 -> flash 自制滚动条 登录 -> 注册 -> 回复主题 -> 发表主题

无言沙漠 2006-10-14 14:55

可以完成一个.还是两个都要啊.
loadVariablesNum("aboutus.txt", 0);
begin = 171.3;
//最始Y轴坐标.
end = 465.3;
//Y轴上的未端坐标
bex = 480.3;
//最始X轴坐标
dis = end-begin;
//滚动条所能活动的Y轴上的距离
_root.btscroll._y = begin;
//设置滚动条的初始位置
btscroll.onPress = function() {
    scroll_lock = "no";
};
btscroll.onRelease = function() {
    scroll_lock = "yes";
    btscroll.stopDrag();
};
btscroll.useHandCursor = false;
btscrollbg.onMouseUp = function() {
    scroll_lock = "yes";
};
_root.onEnterFrame = function() {
//这个是拖动的滚动
    if (scroll_lock == "no") {
          btscroll.startDrag(false, bex, begin, bex, end);
          //括号里的几个数字就是滚动条的活动范围
          pre = Math.floor((btscroll._y-begin)/dis*100);
          //拖动滚动的比例距离   
          _root.mytext.scroll = Math.floor(pre/100*(_root.mytext.maxscroll));
          //设置文本的滚动
    } else {
          btscroll.stopDrag();
          if (_root.mytext.scroll == _root.mytext.maxscroll) {
                btscroll._y = end;
                //滚动条的最未端的位置.
          } else {
                btscroll._y = Math.floor(dis*(_root.mytext.scroll/_root.mytext.maxscroll))+begin;
          }
    }
//这是按上下的流动
    if (flag == 0) {
          if (_root.mytext.scroll<_root.mytext.maxscroll) {
                _root.mytext.scroll = _root.mytext.scroll+1;
          } else {
                _root.mytext.scroll = _root.mytext.maxscroll;
          }
    }
    if (flag == 1) {
          _root.mytext.scroll = _root.mytext.scroll-1;
    }
};
//加下面的事件侦听
aa = new Object();
aa.onMouseUp = function() {
    scroll_lock = "yes";
    _root._global.flag = 2;
};
Mouse.addListener(aa);
stop();

吸血狼王 2006-10-14 14:59
眼花了``不懂怎么编

无言沙漠 2006-10-14 17:59
今天就用这个做了一个
还不错,hoho

cc2005 2007-06-30 00:43
我也眼花


查看完整版本: [-- flash 自制滚动条 --] [-- top --]


[ 五颜六色论坛 ]

Powered by PHPWind 5.0.1 © 2005 苏ICP备05001866号 5y6s.net
Time 0.016565 second(s),query:4 Gzip enabled