0 Replies Latest reply on Jul 2, 2014 5:03 AM by sumit.king7

    Recalculate measuredHeight of List in case of variableRowHeight

    sumit.king7

      I have a list with variableRowHeight as "true" and useVirtualLayout as "true". I am having 5 items in list. four of them have height of 40px while one of them has only 10px.

      Now the height of list showing on screen is 40x5 = 200px. But I want 40x4 + 10x1 = 170px.

       

      I extended list class and overrided measure function as:

       

      override protected function measure():void

        {

        super.measure();

        measuredHeight = measuredHeightOfItems();

        }

       

        private function measuredHeightOfItems():Number

        {

        var mHeight:Number = 0;

        for (var itemIndex:int = 0; itemIndex < dataGroup.numChildren; itemIndex++ )

        {

        var e:DisplayObject = dataGroup.getChildAt(itemIndex);

        mHeight += e.height;

        }

      return mHeight;

        }

       

      Now whenever any item is removed from list, it still shows numChildren as unupdated.