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

    
<mx:Script>
        
<![CDATA[

            import mx.binding.utils.BindingUtils;
            import mx.controls.Label;            
            
            internal var mylabel:Label=new Label();
            
            internal function init():void{
                
                this.addChild(mylabel);
                mylabel.x=300;
                mylabel.y=100;
                mylabel.width=200;
                mylabel.height=50;
                mylabel.text="10";                
                
                BindingUtils.bindProperty(mylabel,"text",fsize,"value");   
            }
       
        
]]>
    
</mx:Script>

    
<mx:HSlider x="47" y="170" width="283" id="fsize" minimum="10" maximum="50" />
</mx:Application>




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

    
<mx:Script>
        
<![CDATA[
            
    
            import mx.binding.utils.BindingUtils;
            import mx.controls.Label;            
            
            internal var mylabel:Label=new Label();
            
            internal function init():void{
                
                this.addChild(mylabel);
                mylabel.x=300;
                mylabel.y=100;
                mylabel.width=200;
                mylabel.height=50;
                mylabel.text="10";                
                  
                BindingUtils.bindSetter(setTxt,fsize,"value");
            }
            
            internal function setTxt(txt:String):void{
                mylabel.text=txt;
            }
            
        
]]>
    
</mx:Script>

    
<mx:HSlider x="47" y="170" width="283" id="fsize" minimum="10" maximum="50" />
</mx:Application>




posted on 2010-03-06 21:03 Ying-er 阅读(214) 评论(0)  编辑  收藏 所属分类: Flex3.0

只有注册用户登录后才能发表评论。


网站导航: