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;
}
精彩评论