| 无言沙漠 |
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(); |
|