📄 fuicomponentsclass.as
字号:
}}FUIComponentClass.prototype.myOnKillFocus = function(){ this.tabFocused = true; this.focused =false; this.focusRect.removeMovieClip(); Key.removeListener(this.keyListener);}FUIComponentClass.prototype.executeCallBack = function(){ this.handlerObj[this.changeHandler](this);}// An FUIComponentClass Helper for the styleFormat : // puts a styleFormat value into the component's styleTable,// updates the component (the coloredMCs that make up a skin)FUIComponentClass.prototype.updateStyleProperty = function(styleFormat, propName){ this.update(); this.setStyleProperty(propName, styleFormat[propName], styleFormat.isGlobal);}FUIComponentClass.prototype.update = function(){ };FUIComponentClass.prototype.setStyleProperty = function(propName, value, isGlobal){ if (value=="") return; var tmpValue = parseInt(value); if (!isNaN(tmpValue)) { value = tmpValue; } var global = (arguments.length>2) ? isGlobal : false; if (this.styleTable[propName]==undefined) { this.styleTable[propName] = new Object(); this.styleTable[propName].useGlobal=true; } if (this.styleTable[propName].useGlobal || !global) { this.styleTable[propName].value = value; if (this.setCustomStyleProperty(propName, value)) { // a hook for extending further styleProperty reactions. } else if (propName == "embedFonts") { this.invalidate("setSize"); } else if (propName.substring(0,4)=="text") { if (this.textStyle==undefined) { this.textStyle = new TextFormat(); } //fix for styles var textProp = propName.substring(4, propName.length); var firstChar = textProp.substring(0,1); firstChar = firstChar.toLowerCase(); textProp = firstChar+(textProp.substring(1,textProp.length)); this.textStyle[textProp] = value; this.invalidate("setSize"); } else { for (var j in this.styleTable[propName].coloredMCs) { var myColor = new Color(this.styleTable[propName].coloredMCs[j].link); if (this.styleTable[propName].value==undefined) { var myTObj = { ra: '100', rb: '0', ga: '100', gb: '0', ba: '100', bb: '0', aa: '100', ab: '0'}; myColor.setTransform(myTObj); } else { this.chooseFillType(this.styleTable[propName].coloredMCs[j].link, value, this.styleTable[propName].coloredMCs[j].fillType); } } } this.styleTable[propName].useGlobal = global; }}/* Another styleFormat helper --/ A skin mc calls up to this to register its existence and the/ styleTable property it wants to listen to */FUIComponentClass.prototype.registerSkinElement = function(skinMCRef, propName, fillType){ if(skinMCRef == undefined) return; if (this.styleTable[propName]==undefined) { this.styleTable[propName] = new Object(); this.styleTable[propName].useGlobal = true; } if (this.styleTable[propName].coloredMCs==undefined) { this.styleTable[propName].coloredMCs = new Object(); } if(this.styleTable[propName].coloredMCs[skinMCRef] == undefined){ this.styleTable[propName].coloredMCs[skinMCRef] = new Object(); } this.styleTable[propName].coloredMCs[skinMCRef].link = skinMCRef; this.styleTable[propName].coloredMCs[skinMCRef].fillType = (fillType == undefined)? 'default' : fillType; if (this.styleTable[propName].value != undefined) { this.chooseFillType(skinMCRef, this.styleTable[propName].value, this.styleTable[propName].coloredMCs[skinMCRef].fillType); }}FUIComponentClass.prototype.getPref = function(inMc){ var pref = inMc._parent._currentframe; if(inMc._parent._totalframes == 1) return (this.getPref(inMc._parent)); else return (pref == undefined)? '' : pref;}FUIComponentClass.prototype.chooseFillType = function(skinMCRef, val, fillType){ if(skinMCRef == undefined || skinMCRef._name == '') return; //trace('Choose feel type |' + skinMCRef + '|'); //trace(' Ref ' + skinMCRef + ' || val ' + val + ' || fillType ' + fillType); // inSets descriprion : [fillType] = {linear, radial}, [figure] = {rect, circle, top_circle, bottom_circle}, // [orientType] = {v, vb, h, hl, vt, hr} (only for 'linear' fill type) // v - vertical, vb - vertical bottom, vt - vertical top // h - horizontal, hl - horizontal left, hr - horizontal right var inSets = new Object(); switch(fillType) { case 'default': var myColor = new Color(skinMCRef); myColor.setRGB(val); break; case 'HLinear': case 'HLLinear': case 'HRLinear': inSets.fillType = 'linear'; if(fillType == 'HLinear') inSets.orientType = 'h'; if(fillType == 'HLLinear') inSets.orientType = 'hl'; if(fillType == 'HRLinear') inSets.orientType = 'hr'; inSets.figure = 'rect'; fillGradient(skinMCRef, val, inSets); break; case 'VLinear': case 'VTLinear': case 'VBLinear': inSets.fillType = 'linear'; if(fillType == 'VLinear') inSets.orientType = 'v'; if(fillType == 'VTLinear') inSets.orientType = 'vt'; if(fillType == 'VBLinear') inSets.orientType = 'vb'; inSets.figure = 'rect'; fillGradient(skinMCRef, val, inSets); break; case 'VBLinearBrighter': inSets.fillType = 'linear'; inSets.orientType = 'vb'; inSets.figure = 'rect'; fillGradient(skinMCRef, ex_brighter(val, 0.6), inSets); break; case 'TopCircleLinear': case 'BottomCircleLinear': inSets.fillType = 'linear'; inSets.orientType = 'h'; if(fillType == 'TopCircleLinear') inSets.figure = 'top_circle'; if(fillType == 'BottomCircleLinear') inSets.figure = 'bottom_circle'; fillGradient(skinMCRef, val, inSets); break; case 'AquaButton': inSets.fillType = 'linear'; inSets.orientType = 'vt'; inSets.figure = 'aqua_button'; fillGradient(skinMCRef, val, inSets); break; case 'Brighter': var myColor = new Color(skinMCRef); myColor.setRGB(ex_brighter(val, 0.40)); break; default : var myColor = new Color(skinMCRef); myColor.setRGB(val); break; }}// ============ styleFormat Class =========== //_global.FStyleFormat = function(){ this.nonStyles = {listeners:true, isGlobal:true, isAStyle:true, addListener:true, removeListener:true, nonStyles:true, applyChanges:true}; this.listeners = new Object(); this.isGlobal = false; if (arguments.length>0) { for (var i in arguments[0]) { this[i] = arguments[0][i]; } }}_global.FStyleFormat.prototype = new Object();// ::: PUBLIC FStyleFormat MethodsFStyleFormat.prototype.addListener = function(){ for (var arg=0; arg<arguments.length; arg++) { var mcRef = arguments[arg]; this.listeners[arguments[arg]] = mcRef; for (var i in this) { if (this.isAStyle(i)) { mcRef.updateStyleProperty(this, i.toString()); } } }}FStyleFormat.prototype.removeListener = function(component){ this.listeners[component] =undefined; for (var prop in this) { if (this.isAStyle(prop)) { if (component.styleTable[prop].useGlobal==this.isGlobal) { component.styleTable[prop].useGlobal = true; var value = (this.isGlobal) ? undefined : globalStyleFormat[prop]; component.setStyleProperty(prop, value, true); } } }}FStyleFormat.prototype.applyChanges = function(){ var count=0; for (var i in this.listeners) { var component = this.listeners[i]; if (arguments.length>0) { for (var j=0; j<arguments.length; j++) { if (this.isAStyle(arguments[j])) { component.updateStyleProperty(this, arguments[j]); } } } else { for (var j in this) { if (this.isAStyle(j)) { component.updateStyleProperty(this, j.toString()); } } } } if(this.intervalID == null) this.intervalID = setInterval(this.applyChangesHandler, 900, this); }FStyleFormat.prototype.applyChangesHandler = function(inTarget){ clearInterval(inTarget.intervalID); inTarget.handlerObj[inTarget.handlerFunc](); inTarget.intervalID = null; inTarget.handlerObj = null; inTarget.handlerFunc = null;}FStyleFormat.prototype.setApplyChangesHandler = function(inObj, inFunc){ this.handlerObj = inObj; this.handlerFunc = inFunc;}// ::: PRIVATE FStyleFormat MethodsFStyleFormat.prototype.isAStyle = function(name){ return (this.nonStyles[name]) ? false : true;}#endinitclip
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -