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 長春語林科技 閱讀(196) 評(píng)論(0)  編輯  收藏 所屬分類: flex
          <2011年3月>
          272812345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

           

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

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 万载县| 临湘市| 千阳县| 托克托县| 昌吉市| 乐都县| 资源县| 龙门县| 驻马店市| 调兵山市| 澜沧| 池州市| 靖宇县| 万盛区| 大庆市| 麦盖提县| 东辽县| 宁都县| 楚雄市| 东明县| 读书| 登封市| 梅州市| 府谷县| 林甸县| 湖州市| 五莲县| 广汉市| 响水县| 崇仁县| 清涧县| 长寿区| 高要市| 阜宁县| 平顺县| 宜良县| 平南县| 如皋市| 花莲县| 保靖县| 盐山县|