📄 fscrollbarclass.as
字号:
var w = this._arrow_width; var h = this.width; switch (this.getSkinFrame()) { case 1 : break; case 2 : if(nForce) { data.type = this.BG_TYPE_SCROLL; _global.xpLook.draw(this.scrollTrack_mc, w, h, data); } this.drawScrollThumb(this.STATE_OUT, nForce); data.dir = 'vert'; data.type = this.BTN_TYPE_SCROLL_LOW; _global.xpLook.draw(up_obj, this._arrow_width, this._arrow_width, data); data.type = this.BTN_TYPE_SCROLL_HI; _global.xpLook.draw(down_obj, this._arrow_width, this._arrow_width, data); break; case 3 : break; case 4 : if(nForce) { data.type = this.BG_TYPE_SCROLL; _global.aquaLook.draw(this.scrollTrack_mc, w, h, data); } this.drawScrollThumb(this.STATE_OUT, nForce); data.dir = 'vert'; data.type = this.BTN_TYPE_SCROLL_LOW; _global.aquaLook.draw(up_obj, this._arrow_width, this._arrow_width, data); data.type = this.BTN_TYPE_SCROLL_HI; _global.aquaLook.draw(down_obj, this._arrow_width, this._arrow_width, data); break; default : break; };}FScrollBarClass.prototype.drawScrollThumb = function(nState, nForce){ if(this.scroll_thumb_state != nState || nForce) { this.scroll_thumb_state = nState; if(this.scrollThumb_mc == undefined) return; var data = {pLink : this, type : this.BTN_TYPE_SCROLL, mode : nState, dir : 'vert'}; this.scrollThumb_mc.clear(); this.scrollThumb_mc._xscale = this.scrollThumb_mc._yscale = 100; if(this.scrollThumb_mc.mask != undefined) this.scrollThumb_mc.mask.removeMovieClip(); switch (this.getSkinFrame()) { case 1 : break; case 2 : var w = this._arrow_width - 0.5; var h = this.thumbHeight + 1; _global.xpLook.draw(this.scrollThumb_mc, w, h, data); break; case 3 : break; case 4 : var w = this._arrow_width; var h = this.thumbHeight; _global.aquaLook.draw(this.scrollThumb_mc, w, h, data); break; default : break; } }}// ::: PRIVATE METHODSFScrollBarClass.prototype.scrollIt = function (inc, mode){ var delt = this.smallScroll; if (inc!="one") { delt = (this.largeScroll==0) ? this.pageSize : this.largeScroll; } var newPos = this.getScrollPosition() + (mode*delt); if (newPos>this.maxPos) { newPos = this.maxPos; } else if (newPos<this.minPos) { newPos = this.minPos; } this.setScrollPosition(newPos);}FScrollBarClass.prototype.startRollOverUpArrow = function(){ this.state = this._parent.STATE_OVER;}FScrollBarClass.prototype.startRollOutUpArrow = function(){ this.state = this._parent.STATE_OUT;}FScrollBarClass.prototype.startRollOverDownArrow = function(){ this.state = this._parent.STATE_OVER;}FScrollBarClass.prototype.startRollOutDownArrow = function(){ this.state = this._parent.STATE_OUT;}FScrollBarClass.prototype.startDragThumb = function(){ this.lastY = this._ymouse; this.onMouseMove = this.controller.dragThumb; this._parent.drawScrollThumb(this._parent.STATE_PRESS);}FScrollBarClass.prototype.startRollOverThumb = function(){ this._parent.drawScrollThumb(this._parent.STATE_OVER);}FScrollBarClass.prototype.startRollOutThumb = function(){ this._parent.drawScrollThumb(this._parent.STATE_OUT);}FScrollBarClass.prototype.dragThumb = function(){ this.scrollMove = this._ymouse - this.lastY; this.scrollMove += this._y; if (this.scrollMove<this.controller.scrollTop) { this.scrollMove = this.controller.scrollTop; } else if (this.scrollMove>this.controller.scrollBot) { this.scrollMove = this.controller.scrollBot; } this._y = this.scrollMove; var c = this.controller; c.scrollPosition = Math.round( (c.maxPos-c.minPos) * (this._y - c.scrollTop) / c.trackHeight) + c.minPos; this.controller.isScrolling = true; updateAfterEvent(); this.controller.executeCallBack();}FScrollBarClass.prototype.stopDragThumb = function(){ this.controller.isScrolling = false; this.onMouseMove = null; this._parent.drawScrollThumb(this._parent.STATE_OUT);}FScrollBarClass.prototype.startTrackScroller = function(){ this.controller.trackScroller(); this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "page", -1);}FScrollBarClass.prototype.scrollInterval = function(inc,mode){ clearInterval(this.scrolling); if (inc=="page") { this.trackScroller(); } else { this.scrollIt(inc,mode); } this.scrolling = setInterval(this, "scrollInterval", 35, inc, mode);}FScrollBarClass.prototype.trackScroller = function(){ if (this.scrollThumb_mc._y+this.thumbHeight<this._ymouse) { this.scrollIt("page",1); } else if (this.scrollThumb_mc._y>this._ymouse) { this.scrollIt("page",-1); }}FScrollBarClass.prototype.stopScrolling = function(){ this.controller.downArrow_mc.gotoAndStop(1); this.controller.upArrow_mc.gotoAndStop(1); clearInterval(this.controller.scrolling); //------------------------------------------------------------------------------------------------// this._parent.drawFrame(); //------------------------------------------------------------------------------------------------//}FScrollBarClass.prototype.startUpScroller = function(){ this.controller.upArrow_mc.gotoAndStop(2); this.controller.scrollIt("one",-1); this.controller.scrolling = setInterval(this.controller, "scrollInterval",500, "one", -1); //------------------------------------------------------------------------------------------------// this._parent.drawFrame(); //------------------------------------------------------------------------------------------------//}FScrollBarClass.prototype.startDownScroller = function(){ this.controller.downArrow_mc.gotoAndStop(2); this.controller.scrollIt("one",1); this.controller.scrolling = setInterval(this.controller, "scrollInterval", 500, "one", 1); //------------------------------------------------------------------------------------------------// this._parent.drawFrame(); //------------------------------------------------------------------------------------------------//}//// Begin Special text scroller functions//FScrollBarClass.prototype.setScrollTarget = function(tF){ if (tF == undefined) { this.textField.removeListener(this); delete this.textField[ (this.horizontal) ? "hScroller" : "vScroller" ]; if (!(this.textField.hScroller==undefined) && !(this.textField.vScroller==undefined)) { this.textField.unwatch("text"); this.textField.unwatch("htmlText"); } } this.textField = undefined; if (!(tF instanceof TextField)) return; this.textField = tF; this.textField[ (this.horizontal) ? "hScroller" : "vScroller" ] = this; this.onTextChanged(); this.onChanged = function() { this.onTextChanged(); } this.onScroller = function() { if (!this.isScrolling) { if (!this.horizontal) { this.setScrollPosition(this.textField.scroll); } else { this.setScrollPosition(this.textField.hscroll); } } } this.textField.addListener(this); this.textField.watch("text", this.callback); this.textField.watch("htmlText", this.callback);}FScrollBarClass.prototype.callback = function(prop, oldVal, newVal){ clearInterval(this.hScroller.synchScroll); clearInterval(this.vScroller.synchScroll); this.hScroller.synchScroll = setInterval(this.hScroller, "onTextChanged", 50); this.vScroller.synchScroll = setInterval(this.vScroller, "onTextChanged", 50); return newVal;}FScrollBarClass.prototype.onTextChanged = function(){ if (!this.enable || this.textField==undefined) return; clearInterval(this.synchScroll); if (this.horizontal) { var pos = this.textField.hscroll; this.setScrollProperties(this.textField._width, 0, this.textField.maxhscroll); this.setScrollPosition(Math.min(pos, this.textField.maxhscroll)); } else { var pos = this.textField.scroll; var pageSize = this.textField.bottomScroll - this.textField.scroll; this.setScrollProperties(pageSize, 1, this.textField.maxscroll); this.setScrollPosition(Math.min(pos, this.textField.maxscroll)); }}FScrollBarClass.prototype.executeCallBack = function(){ if (this.textField==undefined) { super.executeCallBack(); } else { if ( this.horizontal ) { this.textField.hscroll = this.getScrollPosition(); } else { this.textField.scroll = this.getScrollPosition(); } }}Object.registerClass("FScrollBarSymbol", FScrollBarClass);#endinitclip
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -