                 
                 // If we are using virtual layout, only size and position 
                 // the visible elements
-                if (yPos > height && !foundLastVisibleElement)
+                if (yPos > yPosMax && !foundLastVisibleElement)
                 {
                     foundLastVisibleElement = true;
                     // Keep track of the number of elements visible in the viewing area

	//
	//--------------------------------------------------------------------------
	
	override public function updateScrollRect(w:Number, h:Number):void
	{
		var g:GroupBase = target;
		if (!g)
			return;
		
		// Instead of moving the scrollRect position, we reposition the elements
		if (clipAndEnableScrolling)
			g.scrollRect = new Rectangle(0, 0, w, h);
		else
			g.scrollRect = null;
	}
	
	override protected function scrollPositionChanged():void
	{
		if (target)
		{
			target.invalidateDisplayList();
			setIndexInView(0, target.numElements - 1);
		}
	}
	
	override public function getHorizontalScrollPositionDelta(navigationUnit:uint):Number

	override mx_internal function getElementNearestScrollPosition(
		position:Point,elementComparePoint:String = "center"):int
	{
		var index:int = Math.floor(position.y / rowHeight); // may be larger than numElements to indicate wrapping
		
		var element:ILayoutElement;
