2014-02-07 19 views
0

我遇到了一个需要很长时间才能加载100个条目的列表的问题。我正在使用预生成的arraycollection传递给数据提供者,而自定义项呈示器由嵌套容器组成。我称之为list.dataProvider = arraycollection;的那一刻,它约冻结了4秒,然后只有列表出现。带有大型开销数据集的Flex移动列表

有没有解决此问题的解决方法?

以下是我的代码:

[编辑]

private function populateList():void 
     { 
      array = new Array(); 

      for (var i:int =0;i<100;i++) 
      { 
       array.push({ 
        dateLabel:"LIVE", 
        timeLabel:"06:05", 
        homeTeamLabel:"Liverpool", 
        homeScoreLabel:"1", 
        awayScoreLabel:"0", 
        awayTeamLabel:"Chelsea", 
        homeTeamHandicapLabel:"Liverpool", 
        homeHandicapLabel:"2/5", 
        awayTeamHandicapLabel:"Chelsea", 
        awayHandicapLabel:"", 
        priceHomeHandicapLabel:"1.950", 
        priceAwayHandicapLabel:"1.950" 
       }); 
      } 

      trace("done loading"); 

      testarr = new ArrayCollection(array); 

      liveList.dataProvider = testarr; 
     } 

这是我的列表组件:

<s:Scroller width="100%" height="100%" horizontalScrollPolicy="off"> 
    <s:VGroup id="lists" gap="0" left="0" right="0" top="0" bottom="0"> 
     <s:List id="liveList" width="100%" itemRenderer="customItemRenderer" creationComplete="populateList()" 
       contentBackgroundColor="0xf0f0f0" useVirtualLayout="true" depth="0" horizontalScrollPolicy="off" verticalScrollPolicy="off"> 
      <s:layout> 
       <s:VerticalLayout gap="0" variableRowHeight="true" requestedMinRowCount="1" useVirtualLayout="true"/> 
      </s:layout> 

     </s:List> 
    </s:VGroup> 
</s:Scroller> 
+1

你应该显示更多的代码。 – jeremyjjbrown

+0

另请指定您要定位的设备。设备上有这个问题吗?在模拟器中?它是一个调试版本还是一个发布版本? – JeffryHouser

+0

嗨,感谢您的评论,我的代码已被添加。它是Android设备的发布版本。 –

回答

0

原来,当我换列表中的性能受到损害与Scroller和VGroup。当我删除它们时,列表加载得很好。