3 Replies Latest reply on Mar 15, 2010 4:12 AM by AdrianWiecek

    How to change Tab label dyanamically

    Raghuvasa

      Hi All,

       

               How to change tab label dyanmically.

       

              i am using tab navigator and i have two tabs.

              initially specified a name for every tab,

              but now i want to rename the tab by clicking on tab.

       

      Can any one help me regarding this.

       

      thanks

      Raghu

        • 1. Re: How to change Tab label dyanamically
          AdrianWiecek

          Hi,

           

          Try this:

           

          <mx:Script>
                  <![CDATA[
                      import mx.events.IndexChangedEvent;
                      private function changeHandler(event:IndexChangedEvent):void
                      {
                          tabNav.getTabAt(event.newIndex).label = new Date().toTimeString();
                      }
                  ]]>
          </mx:Script>
             
          <mx:TabNavigator id="tabNav"
                  width="100%"
                  height="100%"
                  change="changeHandler(event)">
                  <mx:VBox label="Panel 1" backgroundColor="haloOrange">
                      <mx:Label text="TabNavigator container panel 1"/>
                  </mx:VBox>
                  <mx:VBox label="Panel 2" backgroundColor="haloGreen">
                      <mx:Label text="TabNavigator container panel 2"/>
                  </mx:VBox>
                  <mx:VBox label="Panel 3" backgroundColor="haloBlue">
                      <mx:Label text="TabNavigator container panel 3"/>
                  </mx:VBox>
                  <mx:VBox label="Panel 4" backgroundColor="haloSilver">
                      <mx:Label text="TabNavigator container panel 4"/>
                  </mx:VBox>

          </mx:TabNavigator>

           

           

          Regards,

          Adrian Wiecek

          • 2. Re: How to change Tab label dyanamically
            Raghuvasa Level 1

            Thanks for your Reply.

             

                           and i have one more requirement.

             

            if i double click on the  tab it should show one text box on that tab by replacing with old label,

            and it should set a name to the tab what ever i have written on that text box.

             

             

            thanks

            Raghu.

            • 3. Re: How to change Tab label dyanamically
              AdrianWiecek Level 3

              Try SuperTabBar from http://code.google.com/p/flexlib/ or implement it the same way you just said.

               


              Regards,

              Adrian Wiecek