开发者

Flex 4: Enumerating Spark List items

How to enumerate items of Spark List component after setting dataProvider开发者_如何学Python property?

I mean accessing them as DisplayObject instances.


Iterate over list.dataGroup.numElements, calling list.dataGroup.getElementAt(i):

var i:int = 0;
var n:int = list.dataGroup.numElements;
for (i; i < n; i++)
{
    // getElementAt returns an IVisualElement, but most displayobjects
    // in a list will be IVisualElement (which a UIComponent implements)
    var displayObject:DisplayObject = list.dataGroup.getElementAt(i) as DisplayObject;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜