posts - 325,  comments - 25,  trackbacks - 0

          數(shù)據(jù)綁定
          a) 使用<mx:Binding>
                  單向綁定:<mx:Binding source="bindFrom.text" destination="bindTo.text"/>
                  雙向綁定:<mx:Binding source="bindFrom.text" destination="bindTo.text"/> <mx:Binding source="bindTo.text" destination="bindFrom.text"/>
          示例:

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            backgroundColor="#FFFFFF">
           <mx:Binding source="bindFrom.text" destination="bindTo.text" />
           <mx:Binding source="bindTo.text" destination="bindFrom.text" />
           <mx:Panel title="Simple Binding Example" width="300" height="150">
             <mx:Form>
              <mx:FormItem label="Bind From">
                 <mx:TextInput id="bindFrom" />
               </mx:FormItem>
               <mx:FormItem label="Bind To">
                 <mx:TextInput id="bindTo" />
               </mx:FormItem>
             </mx:Form>
            </mx:Panel>
          </mx:Application>
          b)使用[Bindable]綁定變量到組件
            如果類聲明為[Bindable],那么該類中所有的公共屬性都是可綁定的
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
             backgroundColor="#FFFFFF">
             <mx:Script>
               <![CDATA[
                 [Bindable]
                 public var myLabelName:String = "Hello World";
               ]]>
             </mx:Script>
            <mx:Panel title="Binding With Curly Braces" width="350" height="150">
             <mx:Spacer height="100%"/>
              <mx:Label text="{this.myLabelName}" />
              <mx:Spacer height="100%"/>
            </mx:Panel>
            <mx:TextArea id="ta1" text="" change="this.myLabelName=ta1.text" />
          </mx:Application>

          直接綁定組件:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
             backgroundColor="#FFFFFF">

            <mx:Panel title="Empty Panel" width="{mySlider.value}" height="150" />
            <mx:TextArea width="300" text="The width property of the Panel above is bound to the value property of the HSlider below." />
            <mx:HSlider id="mySlider" snapInterval="5" minimum="100" maximum="350" value="250"/>
          </mx:Application>



          posted on 2011-03-16 13:13 長春語林科技 閱讀(200) 評論(0)  編輯  收藏 所屬分類: flex
          <2011年3月>
          272812345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

           

          長春語林科技?xì)g迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 叙永县| 镶黄旗| 青河县| 河北省| 鄂尔多斯市| 惠东县| 淳安县| 许昌市| 奎屯市| 静安区| 朔州市| 读书| 南陵县| 三原县| 砚山县| 乐昌市| 安西县| 武胜县| 霞浦县| 镇沅| 湖南省| 江西省| 陵水| 沾化县| 闽清县| 平塘县| 盖州市| 巴青县| 绩溪县| 遵义县| 无锡市| 庄浪县| 海林市| 宜昌市| 南涧| 西宁市| 山丹县| 察隅县| 同心县| 乌兰县| 什邡市|