亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Flex 動態(tài)綁定BindingUtils.bindProperty

 更新時間:2009年06月11日 22:39:26   作者:  
Flex 動態(tài)綁定BindingUtils.bindProperty實現(xiàn)代碼。
關(guān)鍵字:BindingUtils.bindProperty
需導(dǎo)入:import mx.binding.utils.BindingUtils;
/**
* 動態(tài)綁定
* @params site:Object 被綁定對象
* @params prop:String 被綁定對象的屬性,如textInput的text屬性
* @params host:Object 監(jiān)視者對象
* @params chain:Object 監(jiān)視者對象的屬性
* @return ChangeWatcher
* **/
BindingUtils.bindProperty(site:Object,prop:String,host:Object,chain:Object);
復(fù)制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute" initialize="init();">

    <mx:Script>
        <!--[CDATA[
            import mx.binding.utils.BindingUtils;
            import mx.binding.utils.ChangeWatcher;

            
            private var watcher1:ChangeWatcher;
            private var watcher2:ChangeWatcher;

            /**
             * 動態(tài)綁定
             * @return void
             * **/
            private function Binding():void {

                //綁定ID為txt2的txtInput
                //綁定屬性為txtInput的text
                //監(jiān)視者ID為txt1的txtInput
                //監(jiān)視者屬性為txtInput的text
                watcher1 = BindingUtils.bindProperty(txt2,"text",txt1,"text");

                //綁定ID為txtComb的txtInput
                //綁定屬性為txtInput的text
                //監(jiān)視者ID為comb的ComboBox
                //監(jiān)視者屬性為ComboBox的value
                watcher2 = BindingUtils.bindProperty(txtComb,"text",comb,"value");
            }

            /**
             * 解除綁定
             * @return void
             * **/
            private function UnBinding():void {
                //解除綁定
                watcher1.unwatch();
                watcher2.unwatch();
            }        
        ]]-->
    </mx:Script>

    <mx:ApplicationControlBar dock="true">
        <mx:Button label="動態(tài)綁定" click="Binding();"/>
        <mx:Button label="解除綁定" click="UnBinding();"/>
    </mx:ApplicationControlBar>

    

    <mx:VBox width="200" height="200">

        <mx:Spacer height="30"/>

        <mx:TextInput id="txt1"/>
        <mx:TextInput id="txt2"/>

        <mx:Spacer height="30"/>

        <mx:ComboBox id="comb">
            <mx:dataProvider>
                <mx:Array>
                    <mx:String>Beijing</mx:String>
                    <mx:String>Shanghai</mx:String>
                    <mx:String>Hangzhou</mx:String>
                </mx:Array>
            </mx:dataProvider>
        </mx:ComboBox>

        <mx:TextInput id="txtComb"/>
        </mx:VBox>
</mx:Application>

相關(guān)文章

最新評論