| //设置遮罩 _mc.setMask(mask_mc); //申明影片剪辑滚动距离变量及按钮和按钮背景影片剪辑的可见性设置 var ypgdjl:Number = _mc._height-mask_mc._height; if (ypgdjl<=0) { _btn._visible = 0; } else { _btn._visible = 1; } //设置按钮的高度和坐标 _btn._height = int(mask_mc._height*mask_mc._height/_mc._height); _btn._x = mask_mc._width; _btn._y = mask_mc._y; //按钮按下开始拖动并设置影片剪辑的坐标 var btntdjl:Number = mask_mc._height-_btn._height; _btn.onPress = function() { delete _mc.onEnterFrame; startDrag(this, false, mask_mc._width, mask_mc._y, mask_mc._width, btntdjl); _mc.onEnterFrame = function() { this._y = -(int(_btn._y/btntdjl*ypgdjl)); }; }; _btn.onRelease = _btn.onReleaseOutside=function () { stopDrag(); delete _mc.onEnterFrame; }; //滚动鼠标齿轮并设置影片剪辑滚动及按钮的坐标 _mc.onRollOver = function() { mouseListener = new Object(); mouseListener.onMouseWheel = function(delta:Number) { delete _mc.onEnterFrame; _mc._y += delta*8; _mc.onEnterFrame = function() { _btn._y = -(int(_mc._y*btntdjl/ypgdjl)); if (this._y>=0) { this._y = 0; _btn._y = 0; delete this.onEnterFrame; } if (this._y<=-ypgdjl) { this._y = -ypgdjl; _btn._y = mask_mc._height-_btn._height; delete this.onEnterFrame; } }; }; Mouse.addListener(mouseListener); }; _mc.onRollOut = function() { Mouse.removeListener(mouseListener); }; |
![]() |
滚动条.rar |
admin#flashas.net (#为@) 联系QQ:
:40777822
浙ICP备06033001号