1 Reply Latest reply on Jun 19, 2009 9:42 PM by shintashi

    Frame Navigation Problems

    shintashi

      I've got a navigation bar similar to progress bars you see in online applications, with 12 steps indicated by boxes.  The goal is as follows:

      if you are on page N, then box N is Gold. Pages you are not on are labled by Grey Boxes. Pages you are not on But have completed/edited are labeled by Light Gold.

       

       

      instead of working like I thought it ought have, the colors while beggining in grey (frame1)switch to gold when selected (that part works) or light gold when unselected. I tampered with the conditions of the first stage to try to get a third color to show up, but instead of seeing three colors, the "previously visited" page markers are all labled as "currently active"/gold.

       

      I also get the feeling the code below is extremely redundant but my attempts at reducing it functions ended in total failure.

       

      ----- code -----

       

       

      st1 = 0; //off; if st1 = 1, stage condition = complete,
      st2 = 0;
      st3 = 0;
      st4 = 0;
      st5 = 0;
      st6 = 0;
      st7 = 0;
      st8 = 0;
      st9 = 0;
      st10 = 0;
      st11 = 0;
      st12 = 0; //last stage;

       

       

       

      onEnterFrame = function(){
          if(1 == 0){st1 = 1;}else{st1 = 0;} //test
          if(textA1 != "" || TextA2 != ""){st2 = 1;}else{st2 = 0;}
          if(TextA3 != ""){st3 = 1;}else{st3 = 0;}
          if(TextA4 != ""){st4 = 1;}else{st4 = 0;}
          if(TextA5 != ""){st5 = 1;}else{st5 = 0;}
          if(TextA6 != ""){st6 = 1;}else{st6 = 0;}
          if(TextA7 != ""){st7 = 1;}else{st7 = 0;}
          if(TextA8 != ""){st8 = 1;}else{st8 = 0;}
          if(TextA9 != ""){st9 = 1;}else{st9 = 0;}
          if(TextA10 != "" ){st10 = 1;}else{st10 = 0;}
          if(TextA11 != "" ){st11 = 1;}else{st10 = 0;}
          if(TextA12 != "" ){st12 = 1;}else{st12 = 0;}  

       

       

       

       

       

       

       

      navigation.stage1.onPress = function(){ navigation.gotoAndStop("frame1");
      navigation.stage1.gotoAndStop("frame2");
      if(st2 == 0){navigation.st2.gotoAndStop("frame1");}else{navigation.stage2.gotoAndStop("frame3");}    
      if(st3 == 0){navigation.st3.gotoAndStop("frame1");}else{navigation.stage3.gotoAndStop("frame3");}    
      if(st4 == 0){navigation.st4.gotoAndStop("frame1");}else{navigation.stage4.gotoAndStop("frame3");}    
      if(st5 == 0){navigation.st5.gotoAndStop("frame1");}else{navigation.stage5.gotoAndStop("frame3");}    
      if(st6 == 0){navigation.st6.gotoAndStop("frame1");}else{navigation.stage6.gotoAndStop("frame3");}    
      if(st7 == 0){navigation.st7.gotoAndStop("frame1");}else{navigation.stage7.gotoAndStop("frame3");}    
      if(st8 == 0){navigation.st8.gotoAndStop("frame1");}else{navigation.stage8.gotoAndStop("frame3");}    
      if(st9 == 0){navigation.st9.gotoAndStop("frame1");}else{navigation.stage9.gotoAndStop("frame3");}    
      if(st10 == 0){navigation.st10.gotoAndStop("frame1");}else{navigation.stage10.gotoAndStop("frame3");}    
      if(st11 == 0){navigation.st11.gotoAndStop("frame1");}else{navigation.stage11.gotoAndStop("frame3");}    
      if(st12 == 0){navigation.st12.gotoAndStop("frame1");}else{navigation.stage12.gotoAndStop("frame3");}    
      }   
         
      navigation.stage2.onPress = function(){ navigation.gotoAndStop("frame2");
      navigation.stage2.gotoAndStop("frame2");
      if(st1 == 0){navigation.st1.gotoAndStop("frame1");}else{navigation.stage1.gotoAndStop("frame3");}    
      if(st3 == 0){navigation.st3.gotoAndStop("frame1");}else{navigation.stage3.gotoAndStop("frame3");}    
      if(st4 == 0){navigation.st4.gotoAndStop("frame1");}else{navigation.stage4.gotoAndStop("frame3");}    
      if(st5 == 0){navigation.st5.gotoAndStop("frame1");}else{navigation.stage5.gotoAndStop("frame3");}    
      if(st6 == 0){navigation.st6.gotoAndStop("frame1");}else{navigation.stage6.gotoAndStop("frame3");}    
      if(st7 == 0){navigation.st7.gotoAndStop("frame1");}else{navigation.stage7.gotoAndStop("frame3");}    
      if(st8 == 0){navigation.st8.gotoAndStop("frame1");}else{navigation.stage8.gotoAndStop("frame3");}    
      if(st9 == 0){navigation.st9.gotoAndStop("frame1");}else{navigation.stage9.gotoAndStop("frame3");}    
      if(st10 == 0){navigation.st10.gotoAndStop("frame1");}else{navigation.stage10.gotoAndStop("frame3");}    
      if(st11 == 0){navigation.st11.gotoAndStop("frame1");}else{navigation.stage11.gotoAndStop("frame3");}    
      if(st12 == 0){navigation.st12.gotoAndStop("frame1");}else{navigation.stage12.gotoAndStop("frame3");}    
      }

       

      navigation.stage3.onPress = function(){ navigation.gotoAndStop("frame3");

       

      etc. (the pattern repeats for all 12)

        • 1. Re: Frame Navigation Problems
          shintashi Level 1

          fixed it:

           

          function act(stageN){
          stageN.gotoAndStop("frame2");
              }
          function fin(stageN){
          stageN.gotoAndStop("frame3");
              }   
          function rei(stageN){
          stageN.gotoAndStop("frame1");
              }  

           


          onEnterFrame = function(){
                 
          st1.onPress = function(){
              act(st1); navigation.gotoAndStop("frame1");
              if($t2 == 0){rei(st2);}else{fin(st2);}
              if($t3 == 0){rei(st3);}else{fin(st3);}
              if($t4 == 0){rei(st4);}else{fin(st4);}
              if($t5 == 0){rei(st5);}else{fin(st5);}
              if($t6 == 0){rei(st6);}else{fin(st6);}
              if($t7 == 0){rei(st7);}else{fin(st7);}
              if($t8 == 0){rei(st8);}else{fin(st8);}
              if($t9 == 0){rei(st9);}else{fin(st9);}
              if($t10 == 0){rei(st10);}else{fin(st10);}
              if($t11 == 0){rei(st11);}else{fin(st11);}
              if($t12 == 0){rei(st12);}else{fin(st12);}
              }
             
          st2.onPress = function(){
              act(st2); navigation.gotoAndStop("frame2");

          etc. (pattern repeats 11 more times)

          I admit it could be more condensed though.