posts - 325,  comments - 25,  trackbacks - 0

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

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 凯里市| 平利县| 桃江县| 安康市| 德州市| 汉川市| 额敏县| 磴口县| 新民市| 麦盖提县| 石楼县| 夏邑县| 松阳县| 潮安县| 兴化市| 三河市| 浙江省| 洛浦县| 上高县| 西畴县| 昔阳县| 永新县| 永登县| 朔州市| 乌拉特中旗| 陈巴尔虎旗| 虹口区| 三门县| 永和县| 灌云县| 如东县| 盐城市| 海林市| 金阳县| 社会| 乌拉特前旗| 镇远县| 巴东县| 浦城县| 婺源县| 唐海县|