0 Replies Latest reply on Apr 7, 2010 4:13 PM by dan.biran-e4MIyz

    TileLayout updateDisplayList force render virtualElements causes weird repaint

    dan.biran-e4MIyz

      I'm using a TileLayout that I've written where I override the updateDisplayList to force items that are virtual to render ahead of time before they are scrolled to:

       

         override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
         {
              super.updateDisplayList(unscaledWidth, unscaledHeight);
                     
              if (!target)
                   return;
                     
              if (!typicalLayoutElement)
                   return;
                     
              if (target.numElements <= 0)
                   return;

       

      for ( var i:int=0; i< target.numElements; i++ )
      {
           var element:UIComponent = target.getElementAt( i ) as UIComponent;
                             
           if ( element )
           {
                element.invalidateProperties();
           }
           else
           {
                trace("element " + i.toString() + " wasn't there");
                var item:Object = (target.getVirtualElementAt(i) as IItemRenderer).data;
           }
      }

         }

       

      if I comment out the line "element.invalidateProperties();" to try to remove some of the flicker on scrolling I end up with some strange painting locations for the virtual elements where other items are overlapped.

       

      Any idea how to force the virtualelements to render their off screen content without this problem?