You would want to create a [Bindable] data provider of type ArrayCollection.
Like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="100%" height="100%"
creationComplete="onCreationComplete();" >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var myDataProvider:ArrayCollection;
private function onCreationComplete(): void {
var itemList:Array = new Array();
var item:Object;
for( var i:int = 0; i < 10; i++ ) {
item = new Object();
item.data = i;
itemList.push( item );
}
myDataProvider = new ArrayCollection( itemList );
}
]]>
</mx:Script>
<mx:Panel id="idBoxFrame" width="100%" height="100%" >
<mx:List id="idDataList" labelField="data" dataProvider="{myDataProvider}" />
</mx:Panel>
</mx:Application>
You can also update the data provider directly by using myDataProvider.addItem(item) in the loop, but this will update the display list 10 times instead of one which takes more processor work.
Best regards,
...aaron