📄 combobox.as
字号:
//return (this.labelFunction()(_loc2));
}
else if (typeof(_loc2) != "object")
{
return (_loc2);
}
else if (_loc2[labelField] != undefined)
{
return (_loc2[labelField]);
}
else if (_loc2.label != undefined)
{
return (_loc2.label);
}
else
{
var _loc3 = " ";
for (var _loc4 in _loc2)
{
if (_loc4 != "__ID__")
{
_loc3 = _loc2[_loc4] + ", " + _loc3;
} // end if
} // end of for...in
_loc3 = _loc3.substring(0, _loc3.length - 3);
return (_loc3);
} // end else if
} // End of the function
function hasDropdown()
{
return (__dropdown != undefined && __dropdown.valueOf() != undefined);
} // End of the function
function tweenEndShow(value)
{
_y = value;
isPressed = true;
} // End of the function
function tweenEndHide(value)
{
_y = value;
this.__set__visible(false);
} // End of the function
function displayDropdown(show)
{
if (show == _showingDropdown)
{
return;
} // end if
var _loc3 = new Object();
_loc3.x = 0;
_loc3.y = height;
this.localToGlobal(_loc3);
if (show)
{
this.getDropdown();
var _loc2 = __dropdown;
_loc2.isPressed = true;
_loc2.rowCount = rowCount;
_loc2.visible = show;
_loc2.onTweenEnd = tweenEndShow;
var _loc5;
var _loc8;
if (_loc3.y + _loc2.height > Stage.height)
{
_loc5 = _loc3.y - this.__get__height();
_loc8 = _loc5 - _loc2.height;
mask._y = -_loc2.height;
}
else
{
_loc5 = _loc3.y - _loc2.height;
_loc8 = _loc3.y;
mask._y = border_mc.height;
} // end else if
var _loc7 = _loc2.selectedIndex;
if (_loc7 == undefined)
{
_loc7 = 0;
} // end if
var _loc4 = _loc2.vPosition;
_loc4 = _loc7 - 1;
_loc4 = Math.min(Math.max(_loc4, 0), _loc2.length - _loc2.rowCount);
_loc2.vPosition = _loc4;
_loc2.move(_loc3.x, _loc5);
_loc2.tween = new mx.effects.Tween(__dropdown, _loc5, _loc8, this.getStyle("openDuration"));
}
else
{
delete __dropdown.dragScrolling;
__dropdown.onTweenEnd = tweenEndHide;
__dropdown.tween = new mx.effects.Tween(__dropdown, __dropdown._y, _loc3.y - __dropdown.height, this.getStyle("openDuration"));
} // end else if
var _loc9 = this.getStyle("openEasing");
if (_loc9 != undefined)
{
__dropdown.tween.easingEquation = _loc9;
} // end if
_showingDropdown = show;
this.dispatchEvent({type: show ? ("open") : ("close"), target: this});
} // End of the function
function onDownArrow()
{
_parent.displayDropdown(!_parent._showingDropdown);
} // End of the function
function keyDown(e)
{
if (e.ctrlKey && e.code == 40)
{
this.displayDropdown(true);
}
else if (e.ctrlKey && e.code == 38)
{
this.displayDropdown(false);
}
else if (e.code == 27)
{
this.displayDropdown(false);
}
else if (e.code == 13)
{
if (_showingDropdown)
{
selectedIndex = __dropdown.selectedIndex;
this.displayDropdown(false);
} // end if
}
else if (!_editable || e.code == 38 || e.code == 40 || e.code == 33 || e.code == 34)
{
selectedIndex = 0 + selectedIndex;
bInKeyDown = true;
var _loc3 = this.__get__dropdown();
_loc3.keyDown(e);
bInKeyDown = false;
selectedIndex = __dropdown.selectedIndex;
} // end else if
} // End of the function
function invalidateStyle(styleProp)
{
__dropdown.invalidateStyle(styleProp);
super.invalidateStyle(styleProp);
} // End of the function
function changeTextStyleInChildren(styleProp)
{
if (dropdown.stylecache != undefined)
{
delete dropdown.stylecache[styleProp];
delete dropdown.stylecache.tf;
} // end if
__dropdown.changeTextStyleInChildren(styleProp);
super.changeTextStyleInChildren(styleProp);
} // End of the function
function changeColorStyleInChildren(sheetName, styleProp, newValue)
{
if (dropdown.stylecache != undefined)
{
delete dropdown.stylecache[styleProp];
delete dropdown.stylecache.tf;
} // end if
__dropdown.changeColorStyleInChildren(sheetName, styleProp, newValue);
super.changeColorStyleInChildren(sheetName, styleProp, newValue);
} // End of the function
function notifyStyleChangeInChildren(sheetName, styleProp, newValue)
{
if (dropdown.stylecache != undefined)
{
delete dropdown.stylecache[styleProp];
delete dropdown.stylecache.tf;
} // end if
__dropdown.notifyStyleChangeInChildren(sheetName, styleProp, newValue);
super.notifyStyleChangeInChildren(sheetName, styleProp, newValue);
} // End of the function
function onUnload()
{
__dropdown.removeMovieClip();
} // End of the function
function _resizeHandler()
{
var _loc2 = owner;
_loc2.mask._width = width;
_loc2.mask._height = height;
} // End of the function
function _changeHandler(obj)
{
var _loc2 = owner;
obj.target = _loc2;
if (this != owner.text_mc)
{
_loc2.selectedIndex = selectedIndex;
if (!_loc2.bInKeyDown)
{
_loc2.displayDropdown(false);
} // end if
} // end if
_loc2.dispatchEvent(obj);
} // End of the function
function _scrollHandler(obj)
{
var _loc2 = owner;
obj.target = _loc2;
_loc2.dispatchEvent(obj);
} // End of the function
function _itemRollOverHandler(obj)
{
var _loc2 = owner;
obj.target = _loc2;
_loc2.dispatchEvent(obj);
} // End of the function
function _itemRollOutHandler(obj)
{
var _loc2 = owner;
obj.target = _loc2;
_loc2.dispatchEvent(obj);
} // End of the function
function modelChanged(eventObj)
{
super.modelChanged(eventObj);
if (__dataProvider.length == 0)
{
text_mc.setText("");
delete this.selected;
}
else if (__dataProvider.length == eventObj.lastItem - eventObj.firstItem + 1 && eventObj.eventName == "addItems")
{
selectedIndex = 0;
} // end else if
} // End of the function
static var symbolName = "ComboBox";
static var symbolOwner = mx.controls.ComboBox;
static var version = "2.0.0.360";
var clipParameters = {labels: 1, data: 1, editable: 1, rowCount: 1, dropdownWidth: 1};
static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.ComboBox.prototype.clipParameters, mx.controls.ComboBase.prototype.clipParameters);
var className = "ComboBox";
var _showingDropdown = false;
var __rowCount = 5;
var dropdownBorderStyle = undefined;
var initializing = true;
var __labelField = "label";
var bInKeyDown = false;
} // End of Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -