给控件绑定数据

给控件绑定数据
Flex提供提供了简单的方法绑定控件属性。在下面的例子中,使用大括号绑定TextArea控件text属性。

 <?xml version="1.0"?>

<!-- mxml/BindingExample.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Panel title="My Application">
<s:VGroup left="10" right="10" top="10" bottom="10">
<s:Label text="Enter Text:"/>
<s:TextInput id="textinput1"
text="Hello"/>
<s:Label text="Bind Text to the TextArea control:"/>
<s:TextArea id="textarea1"
text="{textinput1.text}"/>
<s:Button label="Submit"
click="textinput1.text='Goodbye';"/>
</s:VGroup>
</s:Panel>
</s:Application>

对应的swf文件

/Files/dreamcs/bind.swf 

posted @ 2012-05-28 21:59  thinkpore  阅读(97)  评论(0)    收藏  举报