7 Replies Latest reply on Aug 31, 2011 3:07 PM by Ned Murphy

    Execute code in previous if statement if second if statement is executed?

    prodigalmaster Level 2
      if (variable == 1){
                     //code
                     //Execute this code.
      } else if (variable == 2) {
                     //code
                     //Execute this code and the previous code in totalBullets == 1
      } else if (variable == 3) {
                     //code
                     //Execute this code and the previous code in totalBullets == 1 and 2
      }
      
      

       

       

       

      How do I do the above example?

       

      I dont want to copy the code from the first into the second and the first and second into the third.

       

      My mind isn't working and there is probably an extremelly simple way to get this working.

       

      I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.