Binding to arrays
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
[Bindable]
public var myAC:ArrayCollection = new ArrayCollection([ "A", "B", "C", "D"]);
[Bindable]
public var myAC2:ArrayCollection = new ArrayCollection(["a", "b", "c", "d"]);
</mx:Script>
<mx:List dataProvider="{myAC}" />
<mx:Button label="Change Element" click="myAC[0]='mod One'" />
<mx:Button label="Add Element" click="myAC.addItem('new element');" />
<mx:Button label="Remove Element 0" click="myAC.removeItemAt(0);" />
<mx:Button label="Change ArrayCollection" click="myAC=myAC2" />
</mx:Application>
Related examples in the same category