2010-04-12 42 views
2

在星火列表中可见的项目,我有:如何获得与虚拟界面

  • 号的ArrayCollection;
  • 使用上述ArrayCollection作为它的dataprovider的列表,并且virtualLayout = true;
  • 一个定义ItemRenderer显示带有标签: 一)数量 二)根据人数和次数最多的可见

换句话说,一个y位置,如果我有10个号码的AC ,并且屏幕上只出现5个,这5个的y位置将取决于这5个数字的最大数值。当用户滚动时,这5个元素当然会改变,因此标签在项目渲染器中的位置将会改变。

我的问题:

1)我怎样才能获取“目前”看得见的项目列表? 2)要覆盖哪个事件/方法将帮助我知道列表已滚动/可见项目更改?

谢谢

若昂Saleiro

回答

0

((list.dataGroup.layout) as VerticalLayout).rowCount可能是你要找的。

6

getItemIndicesInView():Vector.<int> 返回此DataGroup中可见的项呈示器的索引。

+0

删除评论。 – swidnikk 2011-04-14 01:29:12

1

我已经解决了我的问题是这样的:

protected function pagedList_touchInteractionEndHandler(event:TouchInteractionEvent):void 
{ 
    var _index:int = (event.currentTarget.scroller.viewport.layout.horizontalScrollPosition/event.currentTarget.scroller.viewport.layout.columnWidth);     
} 

<s:List id="pagedList" scrollSnappingMode="center" selectionColor="#FFFFFF" downColor="#FFFFFF" focusAlpha="0" 
      width="100%" height="100%" useVirtualLayout="true" 
      verticalScrollPolicy="off" horizontalScrollPolicy="on" 
      pageScrollingEnabled="true" 
      itemRenderer="myItemRender" 
      skinClass="skins.PagedListSkin" 
      touchInteractionStart="pagedList_touchInteractionStartHandler(event)" touchInteractionEnd="pagedList_touchInteractionEndHandler(event)" > 
     <s:layout> 
      <s:TileLayout orientation="rows" requestedRowCount="1" 
       columnWidth="{pagedList.width}" rowHeight="{pagedList.height}" 
       verticalGap="0" horizontalGap="0" /> 
     </s:layout> 
</s:List>