1 Reply Latest reply on Nov 9, 2010 12:10 PM by Flex harUI

    Datagrid rendering + flickering

    BasilGr

      The following is part of a air program:

       

      declarations....

      <s:CallResponder id="Games" result="Games_resultHandler(event)" fault="Games_faultHandler(event)"/>

       

       

      script....

      private var soap1:Soap=new Soap;

      [Bindable] protected var paixnidakia:ArrayCollection

       

      private function getTheGames():void{

      Games.token=soap1.getGames()

      }

       

      protected function Games_resultHandler(event:ResultEvent):void
      {
                      paixnidakia=event.result as ArrayCollection;

       

                     //some manipulation of the paixnidakia array is being done here...

                     ..

                     ..

      }

      <mx1:DataGrid styleName="DataGrid" alternatingItemColors="0x363c48"  x="498" y="505" width="567" height="360" dataProvider="{paixnidakia}" draggableColumns="false" cachePolicy="on" cacheAsBitmap="true">
          <mx1:columns>
              <mx1:DataGridColumn headerText="app_id" dataField="col1" visible="false"/>
              <mx1:DataGridColumn headerText="" dataField="icon_path"  width="32" itemRenderer="mx.controls.Image"/>
              <mx1:DataGridColumn headerText="" dataField="title"/>
              <mx1:DataGridColumn headerText="" dataField="local_path" width="32" itemRenderer="mx.controls.Image"/>
              <mx1:DataGridColumn headerText="" dataField="sage" width="32" itemRenderer="mx.controls.Image"/>
              <mx1:DataGridColumn headerText="Release Date" dataField="release_date" width="100"/>
          </mx1:columns>
      </mx1:DataGrid>

       

      When i call getTheGames() the soap fires up the CallResponder, filling the binded paixnidakia ArrayCollection. The paixnidakia is dataProvider to the datagrid..

       

      But there are some issues.

      1) The paixnidakia fills with about 500 results. When i call getTheGames() the entire application freezes while retrieving data + filling the grid. Is there any way (with the binding and not custom filling) to make the application responsive during the fill? (threaded-like).

      2) The two dataFields with the image itemRenderes retrieve images, one from assets embeded in the application and the other with external images.

      When i scroll the datagrid, the cache is not applied, the images are not pre-loaded on the entire datagrid and there is a terrible delay-image loading-flickering. It's like the grid only fills the visible rows, and the rest are left to render on scroll. Is there anyway to pre-load all the rows with images? (without freezing the entire app)

       

      Thank you in advance for your replies