📄 fcomboboxclass.as
字号:
#initclip 3/* FComboBoxClass EXTENDS FScrollSelectListClass This class manages a "pulldown" scrolling list.*/function FComboBoxClass(){ _global._popUpLevel = (_global._popUpLevel==undefined) ? 20000 : _global._popUpLevel+1; // Testing for _root's existence? this.superHolder = _root.createEmptyMovieClip("superHolder" + _popUpLevel, _popUpLevel); var testContainer = this.superHolder.createEmptyMovieClip("testCont", 20000); var testBox = testContainer.attachMovie("FBoundingBoxSymbol", "boundingBox_mc", 0); if (testBox._name==undefined) { // _root doesn't exist. this.superHolder.removeMovieClip(); this.superHolder = this._parent.createEmptyMovieClip("superHolder" + _popUpLevel, _popUpLevel); } else { testContainer.removeMovieClip(); } if (this.rowCount==undefined) { this.rowCount = 8; this.editable = false; } this.setType(this.cmbType); this.itemSymbol = "FComboBoxItemSymbol"; this.showItemSymbolOnTop = false; this.init(); this.permaScrollBar = false; this.width = this._width; this.height =this.proxyBox_mc._height*this._yscale/100; for (var i=0; i<this.labels.length; i++) { this.addItem(this.labels[i], this.data[i]); } this.lastSelected = 0; this.selectItem(0); this._xscale = this._yscale = 100; this.opened = false; this.setSize(this.width); this.highlightTop(false); if (this.changeHandler.length>0) { this.setChangeHandler(this.changeHandler); } this.onUnload = function() { this.superHolder.removeMovieClip(); } this.setSelectedIndex(0, false); this.value = ""; this.focusEnabled = true; this.changeFlag = false;}FComboBoxClass.prototype = new FScrollSelectListClass();Object.registerClass("FComboBoxSymbol", FComboBoxClass);// ::: PUBLIC METHODSFComboBoxClass.prototype.setClickHandler = function(funcName, link){ _global.FlashChatNS._clickFuncName = funcName; _global.FlashChatNS._clickLink = link;}FComboBoxClass.prototype.modelChanged = function(eventObj){ super.modelChanged(eventObj); var event = eventObj.event; if (event=="addRows" || event=="deleteRows") { var diff = eventObj.lastRow - eventObj.firstRow + 1; var mode = (event=="addRows") ? 1 : -1; var len = this.getLength(); var lenBefore = len-mode*diff; if (this.rowCount>lenBefore || this.rowCount>len) { this.invalidate("setSize"); } if (this.getSelectedIndex()==undefined) { this.setSelectedIndex(0, false); } } else if (event=="updateAll") { this.invalidate("setSize"); }}FComboBoxClass.prototype.removeAll = function(){ if (!this.enable) { return; } super.removeAll(); if (this.editable) this.value=""; this.invalidate("setSize");}FComboBoxClass.prototype.setSize = function(w){ if (w==undefined || typeof(w) != "number" || w <= 0){ //!!!resizening || !this.enable) { return; } this.container_mc.removeMovieClip(); this.measureItmHgt(); var dim = testText(this.fLabel_mc.labelField, this.max_label_length.label, this.textStyle); if(this.cmbType == 'resizeable') { w = dim.width + this.itmHgt + 2; } this.proxyBox_mc._width = w; this._proxy_width = w; this.container_mc = this.superHolder.createEmptyMovieClip("container", 3); this.container_mc.tabChildren = false; this.setPopUpLocation(this.container_mc); this.container_mc.attachMovie("FBoundingBoxSymbol", "boundingBox_mc", 0); this.boundingBox_mc = this.container_mc.boundingBox_mc; this.boundingBox_mc.component = this; this.registerSkinElement(this.boundingBox_mc.boundingBox, "background"); this.proxyBox_mc._height = this.itmHgt; this._proxy_height = this.itmHgt; this.numDisplayed = Math.min(this.rowCount, this.getLength()); if (this.numDisplayed<3) { this.numDisplayed = Math.min(3, this.getLength()); } this.height = this.numDisplayed * (this.itmHgt-2) + 2; super.setSize(w, this.height); this.drawSkin(); //attach and paint DownArrow this.setEditable(this.editable); this.container_mc._visible = this.opened; this.highlightTop(false); this.fader = this.superHolder.attachMovie("FBoundingBoxSymbol", "faderX", 4); this.registerSkinElement(this.fader.boundingBox, "background"); this.fader._width = this.width; this.fader._height = this.height; this.fader._visible = false;}FComboBoxClass.prototype.setType = function(inType){ if(inType != undefined) this.type = this.cmbType = inType;}FComboBoxClass.prototype.drawSkin = function(){ var frame = this.getSkinFrame(); if(frame == 1) { if(this._prev_skin != this.getSkinFrame() || this.downArrow == undefined) this.attachMovie("DownArrow", "downArrow", 10); this.downArrow._y = 0; this.downArrow._width = this._proxy_height; this.downArrow._height = this._proxy_height; this.proxyBox_mc._width = this._proxy_width; this.downArrow._x = this._proxy_width - this.downArrow._width; } else if(frame == 2) { if(this._prev_skin != this.getSkinFrame() || this.downArrow == undefined) this.attachMovie("DownArrow", "downArrow", 10); this.downArrow._y = 0; this.downArrow._x = this._proxy_width - 0.8 * this._proxy_height; } else if(frame == 3) { if(this._prev_skin != this.getSkinFrame() || this.downArrow == undefined) this.attachMovie("DownArrowGradient", "downArrow", 10); this.downArrow._y = -0.5; this.downArrow._height = this._proxy_height + 1.0; this.proxyBox_mc._width = this._proxy_width - 4; this.downArrow._x = this._proxy_width - this.downArrow._width ; } else if(frame == 4) { if(this._prev_skin != this.getSkinFrame() || this.downArrow == undefined) this.attachMovie("DownArrow", "downArrow", 10); this.downArrow._y = 0; this.downArrow._x = this._proxy_width - 0.9 * this._proxy_height; } this._prev_skin = this.getSkinFrame(); this.drawFrame();}FComboBoxClass.prototype.update = function(){ if(this._proxy_width == undefined) return; this.proxyBox_mc.clear(); this.proxyBox_mc.box.clear(); this.proxyBox_mc.box.draw();};FComboBoxClass.prototype.drawFrame = function(){ if(this._proxy_width == undefined) return; var t = ''; var comboObj = null; switch(this.downArrow._currentframe) { case 1 : t = 'out'; comboObj = this.downArrow.up; break; case 2 : t = 'press'; comboObj = this.downArrow.down; break; case 3 : t = 'disabled'; comboObj = this.downArrow.disabled; break; } var data = {type : this.BTN_TYPE_COMBO, mode : t, pLink : this}; this.proxyBox_mc.gotoAndStop(2*this.getSkinFrame()-1); this.proxyBox_mc.clear(); comboObj.clear(); if(this.getSkinFrame() != 3) { comboObj.gotoAndStop(this.getSkinFrame()); switch(this.getSkinFrame()) { case 1 : break; case 2 : this.proxyBox_mc._xscale = this.proxyBox_mc._yscale = 100; _global.xpLook.draw(comboObj, 0.8 * this._proxy_height, this._proxy_height, data); data.type = this.BG_TYPE_COMBO; _global.xpLook.draw(this.proxyBox_mc, this._proxy_width, this._proxy_height, data); break; case 3 : break; case 4 : this.proxyBox_mc._xscale = this.proxyBox_mc._yscale = 100; _global.aquaLook.draw(comboObj, 0.9 * this._proxy_height, this._proxy_height, data); data.type = this.BG_TYPE_COMBO; _global.aquaLook.draw(this.proxyBox_mc, this._proxy_width, this._proxy_height, data); break; default: break; } } else { comboObj.gotoAndStop(1); }}FComboBoxClass.prototype.onKillFocus = function(){ this.myOnKillFocus();}FComboBoxClass.prototype.setDataProvider = function(dp){ super.setDataProvider(dp); this.invalidate("setSize"); this.setSelectedIndex(0);}FComboBoxClass.prototype.getValue = function(){ if (this.editable) { return this.fLabel_mc.getLabel(); } else { return super.getValue(); }}FComboBoxClass.prototype.getRowCount = function(){ return this.rowCount;}FComboBoxClass.prototype.setRowCount = function(count){ this.rowCount = (this.getLength()>count) ? Math.max(count,3) : count; this.setSize(this.width); var len = this.getLength(); if (len-this.getScrollPosition()<this.rowCount) { this.setScrollPosition(len-(Math.min(this.rowCount, len))); this.invalidate("updateControl"); }}FComboBoxClass.prototype.setItemSymbolOnTop = function(inVal){ this.showItemSymbolOnTop = inVal;}FComboBoxClass.prototype.setEditable = function(editableFlag){ //!!! resizening //if (!this.enable) return; this.editable = editableFlag; if (!this.editable) { this.onPress = this.pressHandler;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -