📄 fcomboboxclass.as
字号:
this.useHandCursor = false; this.trackAsMenu = true; if(!this.showItemSymbolOnTop) this.attachMovie("FComboBoxItemSymbol", "fLabel_mc", 5, {controller:this, itemNum:-1}); else this.attachMovie(this.itemSymbol, "fLabel_mc", 5, {controller:this, itemNum:-1, isTop:true}); this.fLabel_mc.onRollOver = undefined; //this.fLabel_mc.setSize(this.width-this.itmHgt+1, this.itmHgt); this.fLabel_mc.setSize(this.width - this.downArrow._width + 1, this.itmHgt); this.topLabel = this.getSelectedItem(); this.fLabel_mc.drawItem(this.topLabel, false); this.highlightTop(false); //in aqua skin a combobox is not highlighted this.fLabel_mc.highlight_mc._visible = (this.getSkinFrame() != 2 && this.getSkinFrame() != 4); } else { this.attachMovie("FLabelSymbol", "fLabel_mc", 5); this.fLabel_txt = this.fLabel_mc.labelField; this.fLabel_txt.type = "input"; this.fLabel_txt._x = 4; this.fLabel_txt.onSetFocus = this.onLabelFocus; this.fLabel_mc.setSize(this.width-this.itmHgt-3); delete this.onPress; this.fLabel_txt.onKillFocus = function() { this._parent._parent.myOnKillFocus(); } this.fLabel_mc.setLabel(this.value); this.fLabel_txt.onChanged = function() { this._parent._parent.findInputText(); } this.downArrow.onPress = this.buttonPressHandler; this.downArrow.useHandCursor = false; this.downArrow.trackAsMenu = true; }}FComboBoxClass.prototype.setEnabled = function(enabledFlag){ enabledFlag = (enabledFlag == undefined || typeof(enabledFlag)!="boolean") ? true : enabledFlag; super.setEnabled(enabledFlag); this.registerSkinElement(this.boundingBox_mc.boundingBox, "background"); if (this.editable) { this.fLabel_txt.type = (enabledFlag) ? "input" : "dynamic"; this.fLabel_txt.selectable = enabledFlag; } else if (enabledFlag) { this.fLabel_mc.drawItem(this.topLabel, false); this.setSelectedIndex(this.getSelectedIndex(), false); } this.fLabel_mc.setEnabled(this.enable); this.fLabel_txt.onSetFocus = (enabledFlag) ? this.onLabelFocus : undefined; //this.proxyBox_mc.gotoAndStop( (this.enable) ? "enabled" : "disabled"); //this.downArrow.gotoAndStop( (this.enable) ? 1 : 3); //------------------------------------------------------------------------------------------// this.drawFrame(); //------------------------------------------------------------------------------------------//}FComboBoxClass.prototype.setSelectedIndex = function(index, flag){ super.setSelectedIndex(index, flag); if (!this.editable) { this.topLabel = this.getSelectedItem(); this.fLabel_mc.drawItem(this.topLabel, false); } else { this.value = (flag!=undefined) ? "" : this.getSelectedItem().label; this.fLabel_mc.setLabel(this.value); } this.invalidate("updateControl");}FComboBoxClass.prototype.setValue = function(value){ if (this.editable) { this.fLabel_mc.setLabel(value); this.value = value; }}// ::: PRIVATE METHODSFComboBoxClass.prototype.pressHandler = function(){ this.focusRect.removeMovieClip(); if (this.enable) { if (!this.opened) { this.onMouseUp = this.releaseHandler; } else { this.onMouseUp = undefined; } this.changeFlag = false; if (!this.focused) { this.pressFocus(); this.clickFilter = (this.editable) ? false : true; } if (!this.clickFilter) { this.openOrClose(!this.opened); } else { this.clickFilter = false; } }}FComboBoxClass.prototype.clickHandler = function(itmNum) { if (!this.focused) { if (this.editable) { this.fLabel_txt.onKillFocus = undefined; } this.pressFocus(); } super.clickHandler(itmNum); this.selectionHandler(itmNum); this.onMouseUp = this.releaseHandler;}FComboBoxClass.prototype.highlightTop = function(flag){ if (!this.editable) { this.fLabel_mc.drawItem(this.topLabel, flag); }}FComboBoxClass.prototype.myOnSetFocus = function(){ super.myOnSetFocus(); this.fLabel_mc.highlight_mc.gotoAndStop("enabled"); this.highlightTop(true);}FComboBoxClass.prototype.drawFocusRect = function(){ this.drawRect(-2,-2, this.width+4, this._height+4);}FComboBoxClass.prototype.myOnKillFocus = function(){ if (Selection.getFocus().indexOf("labelField")!=-1) return; // if the label is in focus, don't kill my focus! super.myOnKillFocus(); delete this.fLabel_txt.onKeyDown; this.openOrClose(false); this.highlightTop(false);}FComboBoxClass.prototype.setPopUpLocation = function(mcRef){ mcRef._x = this._x; //if this._parent is tab in tabview as MovieClip not dialog object if ( this._parent._name.indexOf("dialog") < 0) { var point = { x : this._x + this._parent._x, y : this._y + this._parent._y + this._proxy_height}; this._parent._parent.localToGlobal(point); } else { var point = { x : this._x, y : this._y + this._proxy_height}; this._parent.localToGlobal(point); } mcRef._parent.globalToLocal(point); mcRef._x = point.x; mcRef._y = point.y; if (this.height+mcRef._y >= Stage.height) { this.upward = true; mcRef._y = point.y-this.height - this._proxy_height; } else { this.upward = false; }}FComboBoxClass.prototype.openOrClose = function(flag){ if (this.getLength()==0) return; this.setPopUpLocation(this.container_mc); if (this.lastSelected!=-1 && (this.lastSelected<this.topDisplayed || this.lastSelected>this.topDisplayed+this.numDisplayed)) { super.moveSelBy(this.lastSelected-this.getSelectedIndex()); } (flag) ? this.downArrow.gotoAndStop(2) : this.downArrow.gotoAndStop(1); //------------------------------------------------------------------------------------------// this.drawFrame(); //------------------------------------------------------------------------------------------// if (flag==this.opened) { return ; } //!!! begin addition !!! if(_global.FlashChatNS._clickLink != undefined) _global.FlashChatNS._clickLink[_global.FlashChatNS._clickFuncName](); //!!! end addition !!! this.highlightTop(!flag); this.fadeRate = this.styleTable.popUpFade.value; if (!flag || this.fadeRate==undefined || this.fadeRate==0) { this.opened = this.container_mc._visible = flag; return; } // code for fading in - depends on a prop called popUpFade. this.setPopUpLocation(this.fader); this.time = 0; this.const = 85 / Math.sqrt(this.fadeRate); this.fader._alpha = 85; this.container_mc._visible = this.fader._visible = true; this.onEnterFrame = function() { this.fader._alpha = 100 - (this.const * Math.sqrt(++this.time) + 15); if (this.time>=this.fadeRate) { this.fader._visible = false; delete this.onEnterFrame; this.opened = true; } }}FComboBoxClass.prototype.fireChange = function(){ this.lastSelected = this.getSelectedIndex(); if (!this.editable) { this.topLabel = this.getSelectedItem(); this.fLabel_mc.drawItem(this.topLabel, true); } else { this.value=this.getSelectedItem().label; this.fLabel_mc.setLabel(this.value); } this.executeCallBack();}FComboBoxClass.prototype.releaseHandler = function(){ var onCombo = this.boundingBox_mc.hitTest(_root._xmouse, _root._ymouse); if (this.changeFlag) { if (onCombo) { this.fireChange(); } this.openOrClose(!this.opened); } else if (onCombo) { this.openOrClose(false); } else { this.onMouseDown = function() { if (!this.boundingBox_mc.hitTest(_root._xmouse, _root._ymouse) && !this.hitTest(_root._xmouse, _root._ymouse)) { this.onMouseDown = undefined; this.openOrClose(false); } } } this.changeFlag=false; this.onMouseUp=undefined; clearInterval(this.dragScrolling); this.dragScrolling = undefined;}FComboBoxClass.prototype.moveSelBy = function(itemNum){ if (itemNum!=0) { super.moveSelBy(itemNum); if (this.editable) { this.setValue(this.getSelectedItem().label); } if (!this.opened) { if (this.changeFlag && !this.isSelected(this.lastSelected)) { this.fireChange(); } } }}FComboBoxClass.prototype.myOnKeyDown = function(){ if (!this.focused) return ; if (this.editable && Key.isDown(Key.ENTER)) { this.setValue(this.fLabel_mc.getLabel()); this.executeCallBack(); this.openOrClose(false); } else if ( (Key.isDown(Key.ENTER) || (Key.isDown(Key.SPACE)&&!this.editable)) && this.opened) { if (this.getSelectedIndex()!=this.lastSelected) { this.fireChange(); } this.openOrClose(false); this.fLabel_txt.hscroll = 0; } super.myOnKeyDown();}FComboBoxClass.prototype.findInputText = function(){ if (!this.editable) { super.findInputText(); }}FComboBoxClass.prototype.onLabelFocus = function(){ this._parent._parent.tabFocused = false; this._parent._parent.focused = true; this.onKeyDown = function() { this._parent._parent.myOnKeyDown(); } Key.addListener(this);}FComboBoxClass.prototype.buttonPressHandler = function(){ this._parent.pressHandler();}#endinitclipthis.deadPreview._visible = false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -