Binding to array elements
<?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:Text id="text1" text="{myAC[0]}" />
<mx:Text id="text2" text="{myAC.getItemAt(0)}" />
<mx:Button id="button1" label="Change Element" click="myAC[0]='new One'" />
<mx:Button id="button2" label="Change ArrayCollection" click="myAC=myAC2" />
</mx:Application>
Related examples in the same category