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)論排行榜

          主站蜘蛛池模板: 巴林右旗| 绥阳县| 乳源| 本溪市| 洛宁县| 大姚县| 贵阳市| 通榆县| 都江堰市| 万全县| 铅山县| 贞丰县| 聂拉木县| 砀山县| 东台市| 罗山县| 德保县| 县级市| 上林县| 万安县| 云霄县| 西盟| 新晃| 扎囊县| 新田县| 周宁县| 香港| 巴东县| 岳阳县| 如皋市| 曲松县| 交口县| 易门县| 左权县| 正宁县| 视频| 潜江市| 宜章县| 东乌| 屏东县| 宝山区|