CH03_07.mxml
<?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"> <s:Group> <s:layout> <s:HorizontalLayout/> </s:layout> <s:TextInput id="myTextInput1" text="{myTextInput2.text}"/> <s:TextInput id="myTextInput2" text="{myTextInput1.text}"/> </s:Group> </s:Application>
另外一种方法绑定CH03_09.mxml
<?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"> <s:layout> <s:HorizontalLayout/> </s:layout> <fx:Binding source="myTextInput1.text" destination="myTextInput2.text" twoWay="true"/> <s:TextInput id="myTextInput1"/> <s:TextInput id="myTextInput2"/> </s:Application>