📄 simplebutton.as
字号:
class mx.controls.SimpleButton extends mx.core.UIComponent
{
var preset, boundingBox_mc, useHandCursor, skinName, linkLength, _loc2, _loc4, iconName, destroyObject, _width, __width, _height, __height, _loc3, styleName, __emphaticStyleName, enabled, invalidate, __get__toggle, __get__value, __get__selected, pressFocus, dispatchEvent, autoRepeat, getStyle, interval, releaseFocus, createLabel, invalidateStyle, __get__emphasized, __set__emphasized, __set__selected, __set__toggle, __set__value;
static var emphasizedStyleDeclaration;
function SimpleButton()
{
super();
} // End of the function
function init(Void)
{
super.init();
if (preset == undefined)
{
boundingBox_mc._visible = false;
boundingBox_mc._width = boundingBox_mc._height = 0;
} // end if
useHandCursor = false;
} // End of the function
function createChildren(Void)
{
if (preset != undefined)
{
var _loc2 = this[idNames[preset]];
refNames[preset] = _loc2;
skinName = _loc2;
if (falseOverSkin.length == 0)
{
rolloverSkin = fus;
} // end if
if (falseOverIcon.length == 0)
{
rolloverIcon = fui;
} // end if
initializing = false;
}
else if (__state == true)
{
this.setStateVar(true);
}
else
{
if (falseOverSkin.length == 0)
{
rolloverSkin = fus;
} // end if
if (falseOverIcon.length == 0)
{
rolloverIcon = fui;
} // end else if
} // end else if
} // End of the function
function setIcon(tag, linkageName)
{
return (this.setSkin(tag + 8, linkageName));
} // End of the function
function changeIcon(tag, linkageName)
{
linkLength = linkageName.length;
var _loc2 = stateNames[tag] + "Icon";
this[_loc2] = linkageName;
idNames[tag + 8] = _loc2;
this.setStateVar(this.getState());
} // End of the function
function changeSkin(tag, linkageName)
{
var _loc2 = stateNames[tag] + "Skin";
this[_loc2] = linkageName;
idNames[tag] = _loc2;
this.setStateVar(this.getState());
} // End of the function
function viewIcon(varName)
{
var _loc4 = varName + "Icon";
var _loc3 = this[_loc4];
if (typeof(_loc3) == "string")
{
var _loc5 = _loc3;
if (__emphasized)
{
if (this[_loc3 + "Emphasized"].length > 0)
{
_loc3 = _loc3 + "Emphasized";
} // end if
} // end if
if (this[_loc3].length == 0)
{
return;
} // end if
_loc3 = this.setIcon(tagMap[_loc5], this[_loc3]);
if (_loc3 == undefined && _global.isLivePreview)
{
_loc3 = this.setIcon(0, "ButtonIcon");
} // end if
this[_loc4] = _loc3;
} // end if
iconName._visible = false;
iconName = _loc3;
iconName._visible = true;
} // End of the function
function removeIcons()
{
for (var _loc3 = 0; _loc3 < 2; ++_loc3)
{
for (var _loc2 = 8; _loc2 < 16; ++_loc2)
{
this.destroyObject(idNames[_loc2]);
set(stateNames[_loc2 - 8] + "Icon", "");
} // end of for
} // end of for
this.refresh();
} // End of the function
function setSkin(tag, linkageName, initobj)
{
var _loc3 = super.setSkin(tag, linkageName, initobj != undefined ? (initobj) : ({styleName: this}));
this.calcSize(tag, _loc3);
return (_loc3);
} // End of the function
function calcSize(Void)
{
__width = _width;
__height = _height;
} // End of the function
function viewSkin(varName, initObj)
{
var _loc3 = varName + "Skin";
var _loc2 = this[_loc3];
if (typeof(_loc2) == "string")
{
var _loc4 = _loc2;
if (__emphasized)
{
if (this[_loc2 + "Emphasized"].length > 0)
{
_loc2 = _loc2 + "Emphasized";
} // end if
} // end if
if (this[_loc2].length == 0)
{
return;
} // end if
_loc2 = this.setSkin(tagMap[_loc4], this[_loc2], initObj != undefined ? (initObj) : ({styleName: this}));
this[_loc3] = _loc2;
} // end if
skinName._visible = false;
skinName = _loc2;
skinName._visible = true;
} // End of the function
function showEmphasized(e)
{
if (e && !__emphatic)
{
if (mx.controls.SimpleButton.emphasizedStyleDeclaration != undefined)
{
__emphaticStyleName = styleName;
styleName = mx.controls.SimpleButton.emphasizedStyleDeclaration;
} // end if
__emphatic = true;
}
else
{
if (__emphatic)
{
styleName = __emphaticStyleName;
} // end if
__emphatic = false;
} // end else if
} // End of the function
function refresh(Void)
{
var _loc2 = this.getState();
if (enabled == false)
{
this.viewIcon("disabled");
this.viewSkin("disabled");
}
else
{
this.viewSkin(phase);
this.viewIcon(phase);
} // end else if
this.setView(phase == "down");
iconName.enabled = enabled;
} // End of the function
function setView(offset)
{
if (iconName == undefined)
{
return;
} // end if
var _loc2 = offset ? (btnOffset) : (0);
iconName._x = (__width - iconName._width) / 2 + _loc2;
iconName._y = (__height - iconName._height) / 2 + _loc2;
} // End of the function
function setStateVar(state)
{
if (state)
{
if (trueOverSkin.length == 0)
{
rolloverSkin = tus;
}
else
{
rolloverSkin = trs;
} // end else if
if (trueOverIcon.length == 0)
{
rolloverIcon = tui;
}
else
{
rolloverIcon = tri;
} // end else if
upSkin = tus;
downSkin = tds;
disabledSkin = dts;
upIcon = tui;
downIcon = tdi;
disabledIcon = dti;
}
else
{
if (falseOverSkin.length == 0)
{
rolloverSkin = fus;
}
else
{
rolloverSkin = frs;
} // end else if
if (falseOverIcon.length == 0)
{
rolloverIcon = fui;
}
else
{
rolloverIcon = fri;
} // end else if
upSkin = fus;
downSkin = fds;
disabledSkin = dfs;
upIcon = fui;
downIcon = fdi;
disabledIcon = dfi;
} // end else if
__state = state;
} // End of the function
function setState(state)
{
if (state != __state)
{
this.setStateVar(state);
this.invalidate();
} // end if
} // End of the function
function size(Void)
{
this.refresh();
} // End of the function
function draw(Void)
{
if (initializing)
{
initializing = false;
skinName.visible = true;
iconName.visible = true;
} // end if
this.size();
} // End of the function
function getState(Void)
{
return (__state);
} // End of the function
function setToggle(val)
{
__toggle = val;
if (__toggle == false)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -