1 Reply Latest reply on Sep 28, 2011 1:20 PM by targetplanet

    Flex 4 spark tabbar dataGroup index out of order


      I am using a spark TabBar, and I am trying to set the selected color of the tabs different from the first tab.  I have created my custom skins etc., and am using this loop


      for(var i:int = 1;i<pageTabs.dataGroup.numChildren;i++){



      The problem I am having is the the first and third tab are changing to the new selected color, but not the 2nd.




      The first tab should have a selected color of gray, and the other two green, but you can see above that isn't the case.


      It seems the index of the dataGroup children doesn't match the dataprovider.  Since the dataProvider is dynamic, I can't use the TabBars children for my loop, because it always just returns 1. 


      Help Please....

        • 1. Re: Flex 4 spark tabbar dataGroup index out of order
          targetplanet Level 1

          well this is my work around, but loops in loops always seem messy to me.  If anyone has a cleaner solution, please let me know


          for(var i:int = 1;i<pageTabs.dataProvider.length;i++){

                for (var j:int=0; j<pageTabs.dataGroup.numChildren;j++){

                     if(TerrificTabBarButton(pageTabs.dataGroup.getChildAt(j)).label == pageTabs.dataProvider.getItemAt(i).label){

                          TerrificTabBarButton(pageTabs.dataGroup.getChildAt(j)).setStyle("tabSelectedColor","#C0DF BF");