<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="init()">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var arr:ArrayCollection=new ArrayCollection(["one","two"]);
[Bindable]
public var arr1:ArrayCollection=new ArrayCollection(["this one","the tow"]);
]]>
</fx:Script>
<s:TextInput x="281" y="212" text="{arr[0]}"/>
<s:TextInput x="275" y="259" text="{arr.getItemAt(0)}"/>
<s:Button x="339" y="308" label="按钮" click="this.arr[0]='new one'"/>
<s:Button x="442" y="308" label="按钮" click="this.arr=this.arr1"/>
</s:Application>
绑定数组元素最好使用getItemAt()函数,而不是用[]