📄 fpushbuttonclass.as
字号:
FPushButtonClass.prototype.setCloseMinSizeNPos = function(inObj, inPerc, inObj2){ if(this.btnType == this.BTN_TYPE_CLOSE || this.btnType == this.BTN_TYPE_HIDE) { inObj._parent['close_mc']._visible = true; if(this.btnType == this.BTN_TYPE_CLOSE) { inObj._parent['close_mc']['min_icon']._visible = false; inObj._parent['close_mc']['close_icon']._visible = (this.getLabel().toUpperCase() == 'X' || this.getLabel() == '')? true : false; } else { inObj._parent['close_mc']['close_icon']._visible = false; inObj._parent['close_mc']['min_icon']._visible = true; } var hObj = (inObj2 == undefined)? inObj : inObj2; inObj._parent['close_mc']._width = inObj._width * inPerc; inObj._parent['close_mc']._height = hObj._height * inPerc; inObj._parent['close_mc']._x = inObj._x + (inObj._width - inObj._parent['close_mc']._width)/2; inObj._parent['close_mc']._y = hObj._y + (hObj._height - inObj._parent['close_mc']._height)/2; } }FPushButtonClass.prototype.drawDeafaultFrame = function(btnObj){ var b = 1; // border width of frame; var x1 = 0; var y1 = 0; var x2 = this.width; var y2 = this.height; var mc = "frame"; for (var i =0;i<6; i++){ x1 += ((i)%2)*b; y1 += ((i)%2)*b; x2 -= ((i+1)%2)*b; y2 -= ((i+1)%2)*b; var w = Math.abs (x1 - x2)+2*b; var h = Math.abs (y1 - y2)+2*b; btnObj[mc+i]._width = w; btnObj[mc+i]._height = h; btnObj[mc+i]._x = x1-b; btnObj[mc+i]._y = y1-b; } this.setCloseMinSizeNPos(btnObj[mc+5], 0.75); this.setIconSizeNPos(btnObj[mc+5]);}FPushButtonClass.prototype.drawXPFrame = function(btnObj, data){ _global.xpLook.draw(btnObj, this.width - 0.5, this.height - 0.5, data); var obj = {_x : 0, _y : 0, _width : this.width, _height : this.height}; this.setIconSizeNPos(obj); if(this.getLabel().toUpperCase() != 'X' && this.getLabel() != '') btnObj.mc.clear(); return;}FPushButtonClass.prototype.drawGradientFrame = function(btnObj){ var r1 = 5, r2 = 3; //------------------------------------------------------------------------------------------------------// btnObj['aq_tl_round_mc']._width = btnObj['aq_tr_round_mc']._width = r1; btnObj['aq_bl_round_mc']._width = btnObj['aq_br_round_mc']._width = r1; btnObj['aq_tl_round_mc']._height = btnObj['aq_tr_round_mc']._height = r1; btnObj['aq_bl_round_mc']._height = btnObj['aq_br_round_mc']._height = r1; btnObj['aq_tl_round_mc']._x = 0; btnObj['aq_tl_round_mc']._y = 0; btnObj['aq_tr_round_mc']._x = this.width - r1; btnObj['aq_tr_round_mc']._y = 0; btnObj['aq_bl_round_mc']._x = 0; btnObj['aq_bl_round_mc']._y = this.height - r1; btnObj['aq_br_round_mc']._x = this.width - r1; btnObj['aq_br_round_mc']._y = this.height - r1; //------------------------------------------------------------------------------------------------------// btnObj['l_border_mc']._width = btnObj['r_border_mc']._width = (r1 - r2); btnObj['l_border_mc']._height = btnObj['r_border_mc']._height = this.height - 2*r1; btnObj['l_border_mc']._x = 0; btnObj['l_border_mc']._y = r1; btnObj['r_border_mc']._x = this.width - (r1 - r2); btnObj['r_border_mc']._y = r1; //------------------------------------------------------------------------------------------------------// btnObj['t_border_mc']._width = btnObj['b_border_mc']._width = this.width - 2*r1; btnObj['t_border_mc']._height = btnObj['b_border_mc']._height = (r1 - r2); btnObj['t_border_mc']._x = r1; btnObj['t_border_mc']._y = 0; btnObj['b_border_mc']._x = r1; btnObj['b_border_mc']._y = this.height - (r1 - r2); //------------------------------------------------------------------------------------------------------// btnObj['grad_middle_mc']._width = this.width - 2*(r1 - r2); btnObj['grad_middle_mc']._height = this.height - 2*(r1 - r2); btnObj['grad_middle_mc']._x = (r1 - r2); btnObj['grad_middle_mc']._y = (r1 - r2); //------------------------------------------------------------------------------------------------------// this.setCloseMinSizeNPos(btnObj['grad_middle_mc'], 0.6); this.setIconSizeNPos(btnObj['grad_middle_mc']);}FPushButtonClass.prototype.drawAquaFrame = function(btnObj, data){ _global.aquaLook.draw(btnObj, this.width, this.height, data); var obj = {_x : 0, _y : 0, _width : this.width, _height : this.height}; this.setIconSizeNPos(obj); if(this.getLabel().toUpperCase() != 'X' && this.getLabel() != '') btnObj.mc.clear();}FPushButtonClass.prototype.setClickHandler = function(chng,obj){ this.handlerObj = (arguments.length<2) ? this._parent : obj; this.clickHandler = chng;}FPushButtonClass.prototype.executeCallBack = function(){ this.handlerObj[this.clickHandler](this);}FPushButtonClass.prototype.initContentPos = function (mc) { this.incrVal = 1; // DISTANCE TEXT SHIFTS DOWN AND RIGHT ::mr:: this.initx = this[mc]._x - (this.getBtnState())*this.incrVal; this.inity = this[mc]._y - (this.getBtnState())*this.incrVal; this.togx = this.initx + this.incrVal; this.togy = this.inity + this.incrVal;}FPushButtonClass.prototype.initIconPos = function(mc){ this.incrVal = 1; // DISTANCE TEXT SHIFTS DOWN AND RIGHT ::mr:: this.icon_initx = this[mc]._x; this.icon_inity = this[mc]._y; this.icon_togx = this.icon_initx + this.incrVal; this.icon_togy = this.icon_inity + this.incrVal;}FPushButtonClass.prototype.setBtnState = function (state) { if(state != undefined) this.btnState = state; if (this.btnState) { this.fLabel_mc._x = this.togx; this.fLabel_mc._y = this.togy; if(this.icon_mc != undefined) { this.icon_mc._x = this.icon_togx; this.icon_mc._y = this.icon_togy; } }else{ this.fLabel_mc._x = this.initx; this.fLabel_mc._y = this.inity; if(this.icon_mc != undefined) { this.icon_mc._x = this.icon_initx; this.icon_mc._y = this.icon_inity; } } if(state != undefined) this.onRollOver();}FPushButtonClass.prototype.getBtnState = function () { return this.btnState;}FPushButtonClass.prototype.myOnSetFocus = function(){ this.focused = true; super.myOnSetFocus()}FPushButtonClass.prototype.onPress = function (){ this.value = !this.value; this.pressFocus(); this.fpbState_mc.gotoAndStop(3); this.drawFrame(); this.setBtnState(true); // ACCESSIBILITY EVENT if (Accessibility.isActive()){ Accessibility.sendEvent( this, 0, this.EVENT_OBJECT_STATECHANGE,true ); }}FPushButtonClass.prototype.onRelease = function (){ var toDo = this.value && this.toggle; this.fpbState_mc.gotoAndStop((toDo)? 3 : 2); this.drawFrame(); this.executeCallBack(); this.setBtnState(toDo); // ACCESSIBILITY EVENT if (Accessibility.isActive()){ Accessibility.sendEvent( this, 0, this.EVENT_OBJECT_STATECHANGE,true ); }}FPushButtonClass.prototype.onRollOver = function (){ this.fpbState_mc.gotoAndStop((this.value && this.toggle)? 3 : 2); this.drawFrame();}FPushButtonClass.prototype.onRollOut = function (){ this.fpbState_mc.gotoAndStop((this.value && this.toggle)? 3 : 1); this.drawFrame(); }FPushButtonClass.prototype.onReleaseOutside = function (){ this.setBtnState(this.value && this.toggle); this.fpbState_mc.gotoAndStop((this.value && this.toggle)? 3 : 1); this.drawFrame(); }FPushButtonClass.prototype.onDragOut = function (){ this.setBtnState(this.value && this.toggle); this.fpbState_mc.gotoAndStop((this.value && this.toggle)? 3 : 1); this.drawFrame(); }FPushButtonClass.prototype.onDragOver = function (){ this.setBtnState(true); this.fpbState_mc.gotoAndStop(3); this.drawFrame(); }FPushButtonClass.prototype.myOnKeyDown = function( ){ if (Key.getCode() == Key.SPACE && this.pressOnce == undefined ) { this.onPress(); this.pressOnce = 1; }}FPushButtonClass.prototype.myOnKeyUp = function( ){ if (Key.getCode() == Key.SPACE) { this.onRelease(); this.pressOnce = undefined; }}// START ACCESSIBILITY METHODSFPushButtonClass.prototype.get_accRole = function(childId){ return this.master.ROLE_SYSTEM_PUSHBUTTON;}FPushButtonClass.prototype.get_accName = function(childId){ return this.master.getLabel();}FPushButtonClass.prototype.get_accState = function(childId){ if(this.pressOnce){ return this.master.STATE_SYSTEM_PRESSED; }else{ return this.master.STATE_SYSTEM_DEFAULT; }}FPushButtonClass.prototype.get_accDefaultAction = function(childId){ return "Press";}FPushButtonClass.prototype.accDoDefaultAction = function(childId){ this.master.onPress(); this.master.onRelease();}// END ACCESSIBILITY METHODS#endinitclip boundingBox_mc._visible = false;deadPreview._visible = false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -