开发者

Flex 4: Enumerating Spark List items

开发者 https://www.devze.com 2022-12-25 11:01 出处:网络
How to enumerate items of Spark List component after setting dataProvider开发者_如何学Python property?

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

精彩评论

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