flex学习笔记 组件togglebuttonbar

代码:

  
  
  
  
  1. <mx:VBox width="98%" height="190" verticalGap="0"> 
  2.                 <mx:ToggleButtonBar dataProvider="viewstack2" id="tog2" selectedIndex="1"    
  3.                                     horizontalGap="0" paddingLeft="8"  buttonMode="true" useHandCursor="true" 
  4.                                     buttonHeight="41" buttonWidth="114" /> 
  5.                 <mx:HBox width="100%" horizontalGap="0" paddingLeft="5"> 
  6.                     <mx:VRule height="100%" strokeWidth="1" strokeColor="#CCCCCC"/> 
  7.                     <mx:ViewStack width="461" id="viewstack2"> 
  8.                         <mx:VBox id="btn1" icon="{ImageLocator.buttonUp01Class}" paddingLeft="10" width="100%" height="145" > 
  9.                             <s:Image source="assets/group.png"/> 
  10.                         </mx:VBox> 
  11.                         <mx:VBox id="btn2"  icon="{ImageLocator.buttonSelected02Class}"   
  12.                                  paddingLeft="10" width="100%" height="145"> 
  13.                             <s:Image source="assets/grid.png"/> 
  14.                         </mx:VBox> 
  15.                         <mx:VBox id="btn3" icon="{ImageLocator.buttonUp03Class}"    
  16.                                  paddingLeft="10" width="100%" height="145"> 
  17.                             <s:Image source="assets/value.png"/> 
  18.                         </mx:VBox> 
  19.                         <mx:VBox id="btn4" icon="{ImageLocator.buttonUp04Class}"   
  20.                                  paddingLeft="10" width="100%" height="145"> 
  21.                             <s:Image source="assets/sumary.png"/> 
  22.                         </mx:VBox> 
  23.                     </mx:ViewStack> 
  24.                     <mx:VRule height="100%" strokeWidth="1" strokeColor="#CCCCCC"/> 
  25.                 </mx:HBox> 
  26.                 <mx:HBox paddingLeft="5" > 
  27.                     <mx:HRule width="463" strokeWidth="1" strokeColor="#CCCCCC"/> 
  28.                 </mx:HBox> 
  29.                   
  30.             </mx:VBox> 
  31.         </mx:VBox> 

效果:

 

 发现vbox可以加icon然后放到viewstack里面再赋给togglebuttonbar可以让togglebuttonbardeep按钮上有图标,,,

你可能感兴趣的:(Flex)