2013-12-11 33 views
0

我是Flex的新手。 如何将图标移动到TabBar标签的末尾。 TabBars标签区域来自第一个图标图像,然后标签文本。 我想先让他们的标签,然后是图标图像。 如何交换他们的位置?如何将图标移动到flex 3中的TabBar标签的末尾3

特别是当我点击图标(正好在图标上只包含不包括TabBar的标签)我想显示一个警告框。

请帮我找到解决这个问题的方法。 在此先感谢。

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> 
    <mx:Script> 
     <![CDATA[ 
        import mx.controls.Alert; 

     [Bindable] 
     [Embed(source="/assets/graphics/arrowRight.jpg")]     
     public var myIcon1:Class; 
     [Embed(source="/assets/graphics/btn_done_off.gif")]     
     public var myIcon2:Class; 
     [Embed(source="/assets/graphics/btn_exit_off.gif")]     
     public var myIcon3:Class; 
     [Embed(source="/assets/graphics/arrowRightBig.jpg")]     
     public var myIcon4:Class; 
     [Embed(source="/assets/graphics/question2.gif")]     
     public var myIcon5:Class; 





    ]]> 
</mx:Script> 
<mx:Spacer height="1000" > 

</mx:Spacer> 
<mx:TabNavigator width="50%" height="50%" > 
    <mx:VBox id="one" label="one" icon="{myIcon1}" click="Alert.show('Tab1');" /> 
    <mx:VBox id="two" label="two" icon="{myIcon2}" click="Alert.show('Tab2');" /> 
    <mx:VBox id="three" label="three" icon="{myIcon3}" click="Alert.show('Tab3');" /> 
    <mx:VBox id="four" label="four" icon="{myIcon4}" click="Alert.show('Tab4');" /> 
    <mx:VBox id="five" label="five" icon="{myIcon5}" click="Alert.show('Tab5');" /> 
</mx:TabNavigator></mx:Application> 

回答

1

试试这个,

<mx:canvas creationComplete="init()"> 
      <mx:Script> <![CDATA[ 
           import mx.controls.Alert; 

        [Bindable] 
        [Embed(source="/assets/graphics/arrowRight.jpg")]     
        public var myIcon1:Class; 
        [Embed(source="/assets/graphics/btn_done_off.gif")]     
        public var myIcon2:Class; 
        [Embed(source="/assets/graphics/btn_exit_off.gif")]     
        public var myIcon3:Class; 
        [Embed(source="/assets/graphics/arrowRightBig.jpg")]     
        public var myIcon4:Class; 
        [Embed(source="/assets/graphics/question2.gif")]     
        public var myIcon5:Class; 

        private function init():void { 
         var tab:Tab; 
         var len:uint = tabBar.numChildren; 
         for (i=0; i<len; i++) { 
          tab = tabBar.getChildAt(i) as Tab; 
          tab.labelPlacement = "left"; 
         } 
     ]]> 
     </mx:Script> 
     <mx:Spacer height="1000" > 

     </mx:Spacer> 
     <mx:TabNavigator id="tabBar" width="50%" height="50%" > 
      <mx:VBox id="one" label="one" icon="{myIcon1}" click="Alert.show('Tab1');" /> 
      <mx:VBox id="two" label="two" icon="{myIcon2}" click="Alert.show('Tab2');" /> 
      <mx:VBox id="three" label="three" icon="{myIcon3}" click="Alert.show('Tab3');" /> 
      <mx:VBox id="four" label="four" icon="{myIcon4}" click="Alert.show('Tab4');" /> 
      <mx:VBox id="five" label="five" icon="{myIcon5}" click="Alert.show('Tab5');" /> 
     </mx:TabNavigator> 
    </mx:canvas> 

希望它能帮助。

+0

感谢Subash。有用 :) – Allwin

相关问题