toggleButtonbar

togglebuttonbar.mxml

<?xml version="1.0" encoding="utf-8"?>
<!--http://www.javaeye.com/topic/210348-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
 creationComplete="initUI()"> 
    <mx:Style source="style.css"/> 
    <mx:Script> 
        <![CDATA[             
            //导入点击事件对象 
            import mx.events.ItemClickEvent;         
            internal function initUI():void{ 
                var data_arr:Array = new Array(); 
                data_arr.push("Flex"); 
                data_arr.push("Flash"); 
                data_arr.push("Flash Media Server"); 
                data_arr.push("Flex Data Server"); 
                //添加数据源 
                btns.dataProvider = data_arr; 
            } 
            //处理itemClick点击事件 
            internal function btn_click_handler(evt:ItemClickEvent):void{ 
                tip_txt.text = "点击的按钮:"+evt.index+":"+evt.label; 
            } 
        ]]> 
    </mx:Script> 
    <mx:ToggleButtonBar toggleOnClick="true" id="btns" itemClick="btn_click_handler(event);"   
horizontalGap="5" x="22" y="82"> 
    </mx:ToggleButtonBar> 
      
    <mx:Label id="tip_txt" text="还没有点击呢" x="22" y="126" width="266"/> 
      
</mx:Application>

    A+
发布日期:2009年05月19日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: