2

我有:

  • 一个 ArrayCollection 数字;
  • 使用上述 ArrayCollection 作为数据提供者的 List,并且 virtualLayout=true;
  • 显示标签的自定义 ItemRenderer:a)数字 b)y 位置取决于数字和可见的最高数字

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

我的问题:

1)如何获取“当前”可见的项目列表?2) 覆盖哪个事件/方法将帮助我知道列表已滚动/可见项目已更改?

谢谢,

若昂·萨利罗

4

3 回答 3

6

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

于 2011-03-03T14:19:22.557 回答
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>
于 2012-02-22T08:02:48.990 回答
0

((list.dataGroup.layout) as VerticalLayout).rowCount可能正是您正在寻找的。

于 2010-08-13T08:17:00.073 回答