1 Reply Latest reply on Jun 5, 2012 2:35 PM by aktell2007

    Strange behavior with TabNavigator code ...

    aktell2007 Level 1

      Hi,

       

      In my code I use a Tab Navigator and it works OK; yet if I want to use an Alert in Tab (0) ONLY I get that every other Tab is now opening with the same Alert as well ???

      Does anybody have a fix for that ! Thanks in advance regards aktell2007

       

       

                   import mx.controls.Button;
                   import mx.events.FlexEvent;
      
                  private function onCreationCompleteOne():void {  
      
                      for (var i:int = 0; i<tabNavViewOne.getChildren().length; i++) {  
      
                          var tab:Button = tabNavViewOne.getTabAt(i);  
      
                          tab.addEventListener(FlexEvent.BUTTON_DOWN,tabClickHandlerOne, false, 0);
      
                          tabNavViewOne.selectedIndex = 1;
                      }  
                  }  
      
                  private function tabClickHandlerOne(event:Event):void {  
      
                      var child:Object = tabNavViewOne.getChildAt(i);
      
                      for (var i:int = 0; i<tabNavViewOne.getChildren().length; i++) {
      
                          /* event.target == 0 */
                          if (event.target == tabNavViewOne.getTabAt(i)) {
      
                               //  Alert Msg.
                              showAlertTwo();
      
                              // SAVE & CLEAR Text field set Progress Bar ZERO.
                              textAreaOne.text = "";
                              progressBarOne.setProgress(0, 100);
      
                          } /* event.target == 1 */
                          if (event.target == tabNavViewOne.getTabAt(i)) {
      
      
                          } /* event.target == 2 */
                          if (event.target == tabNavViewOne.getTabAt(i)) {
      
      
                          } /* event.target == 3 */
                          if (event.target == tabNavViewOne.getTabAt(i)) {
      
      
                          } /* event.target == 4 */
                          if (event.target == tabNavViewOne.getTabAt(i)) {
      
                          }
                      } 
                  }