Revision: 48791
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 9, 2011 01:37 by mcorlan
Initial Code
private function updateNonVirtual(containerWidth:Number, containerHeight:Number):void {
var layoutTarget:GroupBase = target;
if (!(layoutTarget as DataGroup).dataProvider || (layoutTarget as DataGroup).dataProvider.length == 0)
return;
if (!_containerWidth)
_containerWidth = containerWidth;
if (!_containerHeight)
_containerHeight = containerHeight;
var x:Number = 0;
var y:Number = 0;
var maxWidth:Number = 0;
var maxHeight:Number = 0;
var elementWidth:Number, elementHeight:Number, prevElementHeight:Number;
//add some extra rows after the current view
y = 0;
var count:int = layoutTarget.numElements;
var element:ILayoutElement;
for (var i:int = 0; i < count; i++) {
// get the current element, we're going to work with the
// ILayoutElement interface
element = layoutTarget.getElementAt(i);
// Resize the element to its preferred size by passing
// NaN for the width and height constraints
element.setLayoutBoundsSize(NaN, NaN);
if (element["data"] && _sectionLabel in element["data"]) {
elementWidth = containerWidth;
elementHeight = _sectionHeight;
} else {
elementWidth = _columnWidth;
elementHeight = _tileHeight;
}
element.setLayoutBoundsSize(elementWidth, elementHeight);
// Would the element fit on this line, or should we move
// to the next line?
if (x + elementWidth > containerWidth) {
x = 0;
//move to the next row
y += prevElementHeight + _verticalGap;
}
// Position the element
element.setLayoutBoundsPosition(x, y);
prevElementHeight = elementHeight;
// Update the current position, add the gap
x += elementWidth + _horizontalGap;
}
// Scrolling support - update the content size
layoutTarget.setContentSize(containerWidth, y);
}
Initial URL
http://corlan.org/?p=2987
Initial Description
Initial Title
Custom Layout manager updateDisplayList() method - non virtual
Initial Tags
Initial Language
ActionScript 3