📄 scrollselectlist.as
字号:
class mx.controls.listclasses.ScrollSelectList extends mx.core.ScrollView
{
var invLayoutContent, rows, topRowZ, listContent, __vPosition, __dataProvider, tW, layoutX, layoutY, tH, invRowHeight, invalidate, __get__rowHeight, __height, __get__rowCount, invUpdateControl, __cellRenderer, __get__cellRenderer, __get__labelField, __get__labelFunction, __labelFunction, __get__iconField, __iconField, __get__iconFunction, __iconFunction, getLength, baseRowZ, lastPosition, propertyTable, isSelected, changeFlag, clearSelected, selectItem, lastSelected, wasKeySelected, dispatchEvent, dragScrolling, _ymouse, scrollInterval, isPressed, onMouseUp, getSelectedIndex, enabled, tabEnabled, tabChildren, createEmptyMovieClip, border_mc, __set__cellRenderer, __set__iconField, __set__iconFunction, __set__labelField, __set__labelFunction, __set__rowCount, __set__rowHeight;
function ScrollSelectList()
{
super();
} // End of the function
function layoutContent(x, y, w, h)
{
delete this.invLayoutContent;
var _loc4 = Math.ceil(h / __rowHeight);
roundUp = h % __rowHeight != 0;
var _loc12 = _loc4 - __rowCount;
if (_loc12 < 0)
{
for (var _loc3 = _loc4; _loc3 < __rowCount; ++_loc3)
{
rows[_loc3].removeMovieClip();
delete rows[_loc3];
} // end of for
topRowZ = topRowZ + _loc12;
}
else if (_loc12 > 0)
{
if (rows == undefined)
{
rows = new Array();
} // end if
for (var _loc3 = __rowCount; _loc3 < _loc4; ++_loc3)
{
var _loc2 = rows[_loc3] = listContent.createObject(__rowRenderer, "listRow" + topRowZ++, topRowZ, {owner: this, styleName: this, rowIndex: _loc3});
_loc2._x = x;
_loc2._y = Math.round(_loc3 * __rowHeight + y);
_loc2.setSize(w, __rowHeight);
_loc2.drawRow(__dataProvider.getItemAt(__vPosition + _loc3), this.getStateAt(__vPosition + _loc3));
_loc2.lastY = _loc2._y;
} // end of for
} // end else if
if (w != tW)
{
var _loc11 = _loc12 > 0 ? (__rowCount) : (_loc4);
for (var _loc3 = 0; _loc3 < _loc11; ++_loc3)
{
rows[_loc3].setSize(w, __rowHeight);
} // end of for
} // end if
if (layoutX != x || layoutY != y)
{
for (var _loc3 = 0; _loc3 < _loc4; ++_loc3)
{
rows[_loc3]._x = x;
rows[_loc3]._y = Math.round(_loc3 * __rowHeight + y);
} // end of for
} // end if
__rowCount = _loc4;
layoutX = x;
layoutY = y;
tW = w;
tH = h;
} // End of the function
function getRowHeight(Void)
{
return (__rowHeight);
} // End of the function
function setRowHeight(v)
{
__rowHeight = v;
invRowHeight = true;
this.invalidate();
} // End of the function
function get rowHeight()
{
return (this.getRowHeight());
} // End of the function
function set rowHeight(w)
{
this.setRowHeight(w);
//return (this.rowHeight());
null;
} // End of the function
function setRowCount(v)
{
__rowCount = v;
} // End of the function
function getRowCount(Void)
{
var _loc2 = __rowCount == 0 ? (Math.ceil(__height / __rowHeight)) : (__rowCount);
return (_loc2);
} // End of the function
function get rowCount()
{
return (this.getRowCount());
} // End of the function
function set rowCount(w)
{
this.setRowCount(w);
//return (this.rowCount());
null;
} // End of the function
function setEnabled(v)
{
super.setEnabled(v);
invUpdateControl = true;
this.invalidate();
} // End of the function
function setCellRenderer(cR)
{
__cellRenderer = cR;
for (var _loc2 = 0; _loc2 < rows.length; ++_loc2)
{
rows[_loc2].setCellRenderer(true);
} // end of for
invUpdateControl = true;
this.invalidate();
} // End of the function
function set cellRenderer(cR)
{
this.setCellRenderer(cR);
//return (this.cellRenderer());
null;
} // End of the function
function get cellRenderer()
{
return (__cellRenderer);
} // End of the function
function set labelField(field)
{
this.setLabelField(field);
//return (this.labelField());
null;
} // End of the function
function setLabelField(field)
{
__labelField = field;
invUpdateControl = true;
this.invalidate();
} // End of the function
function get labelField()
{
return (__labelField);
} // End of the function
function set labelFunction(func)
{
this.setLabelFunction(func);
//return (this.labelFunction());
null;
} // End of the function
function setLabelFunction(func)
{
__labelFunction = func;
invUpdateControl = true;
this.invalidate();
} // End of the function
function get labelFunction()
{
return (__labelFunction);
} // End of the function
function set iconField(field)
{
this.setIconField(field);
//return (this.iconField());
null;
} // End of the function
function setIconField(field)
{
__iconField = field;
invUpdateControl = true;
this.invalidate();
} // End of the function
function get iconField()
{
return (__iconField);
} // End of the function
function set iconFunction(func)
{
this.setIconFunction(func);
//return (this.iconFunction());
null;
} // End of the function
function setIconFunction(func)
{
__iconFunction = func;
invUpdateControl = true;
this.invalidate();
} // End of the function
function get iconFunction()
{
return (__iconFunction);
} // End of the function
function setVPosition(pos)
{
if (pos < 0)
{
return;
} // end if
if (pos > 0 && pos > this.getLength() - __rowCount + roundUp)
{
return;
} // end if
var _loc8 = pos - __vPosition;
if (_loc8 == 0)
{
return;
} // end if
__vPosition = pos;
var _loc10 = _loc8 > 0;
_loc8 = Math.abs(_loc8);
if (_loc8 >= __rowCount)
{
this.updateControl();
}
else
{
var _loc4 = new Array();
var _loc9 = __rowCount - _loc8;
var _loc12 = _loc8 * __rowHeight;
var _loc11 = _loc9 * __rowHeight;
var _loc6 = _loc10 ? (1) : (-1);
for (var _loc3 = 0; _loc3 < __rowCount; ++_loc3)
{
if (_loc3 < _loc8 && _loc10 || _loc3 >= _loc9 && !_loc10)
{
rows[_loc3]._y = rows[_loc3]._y + Math.round(_loc6 * _loc11);
var _loc5 = _loc3 + _loc6 * _loc9;
var _loc7 = __vPosition + _loc5;
_loc4[_loc5] = rows[_loc3];
_loc4[_loc5].rowIndex = _loc5;
_loc4[_loc5].drawRow(__dataProvider.getItemAt(_loc7), this.getStateAt(_loc7), false);
continue;
} // end if
rows[_loc3]._y = rows[_loc3]._y - Math.round(_loc6 * _loc12);
_loc5 = _loc3 - _loc6 * _loc8;
_loc4[_loc5] = rows[_loc3];
_loc4[_loc5].rowIndex = _loc5;
} // end of for
rows = _loc4;
for (var _loc3 = 0; _loc3 < __rowCount; ++_loc3)
{
rows[_loc3].swapDepths(baseRowZ + _loc3);
} // end of for
} // end else if
lastPosition = pos;
super.setVPosition(pos);
} // End of the function
function setPropertiesAt(index, obj)
{
var _loc2 = __dataProvider.getItemID(index);
if (_loc2 == undefined)
{
return;
} // end if
if (propertyTable == undefined)
{
propertyTable = new Object();
} // end if
propertyTable[_loc2] = obj;
rows[index - __vPosition].drawRow(__dataProvider.getItemAt(index), this.getStateAt(index));
} // End of the function
function getPropertiesAt(index)
{
var _loc2 = __dataProvider.getItemID(index);
if (_loc2 == undefined)
{
return;
} // end if
return (propertyTable[_loc2]);
} // End of the function
function getStyle(styleProp)
{
var _loc2 = super.getStyle(styleProp);
var _loc3 = mx.styles.StyleManager.colorNames[_loc2];
if (_loc3 != undefined)
{
_loc2 = _loc3;
} // end if
return (_loc2);
} // End of the function
function updateControl(Void)
{
for (var _loc2 = 0; _loc2 < __rowCount; ++_loc2)
{
rows[_loc2].drawRow(__dataProvider.getItemAt(_loc2 + __vPosition), this.getStateAt(_loc2 + __vPosition));
} // end of for
delete this.invUpdateControl;
} // End of the function
function getStateAt(index)
{
return (this.isSelected(index) ? ("selected") : ("normal"));
} // End of the function
function selectRow(rowIndex, transition)
{
if (!selectable)
{
return;
} // end if
var _loc3 = __vPosition + rowIndex;
var _loc8 = __dataProvider.getItemAt(_loc3);
var _loc5 = rows[rowIndex];
if (_loc8 == undefined)
{
return;
} // end if
if (transition == undefined)
{
transition = true;
} // end if
changeFlag = true;
if (!multipleSelection && !Key.isDown(17) || !Key.isDown(16) && !Key.isDown(17))
{
this.clearSelected(transition);
this.selectItem(_loc3, true);
lastSelected = _loc3;
_loc5.drawRow(_loc5.item, this.getStateAt(_loc3), transition);
}
else if (Key.isDown(16) && multipleSelection)
{
if (lastSelected == undefined)
{
lastSelected = _loc3;
} // end if
var _loc4 = lastSelected < _loc3 ? (1) : (-1);
this.clearSelected(false);
for (var _loc2 = lastSelected; _loc2 != _loc3; _loc2 = _loc2 + _loc4)
{
this.selectItem(_loc2, true);
if (_loc2 >= __vPosition && _loc2 < __vPosition + __rowCount)
{
rows[_loc2 - __vPosition].drawRow(rows[_loc2 - __vPosition].item, "selected", false);
} // end if
} // end of for
this.selectItem(_loc3, true);
_loc5.drawRow(_loc5.item, "selected", transition);
}
else if (Key.isDown(17))
{
var _loc7 = this.isSelected(_loc3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -