3 Replies Latest reply on Aug 21, 2009 9:07 PM by kglad

    for loop - find index

    christoon_ca

      Hey all

       

      How do I get the "i" in the "onRelease" function to match with the "i" in another array? When I click the "ch_mc" button, the aVar array all returns "0".

       

      nor = new Array();
      nor[0] = a_mc;
      nor[1] = b_mc;
      nor[2] = c_mc;
      
      aVar = new Array();
      aVar[0] = 0;
      aVar[1] = 0;
      aVar[2] = 0;
      
      for (i=0; i<nor.length; i++)
          nor[i].onRelease = function() {
              aVar[i] = 1
              trace(aVar[i]);
      };
      
      ch_mc.onRelease = function() {
          for (j=0; j<nor.length; j++)
          trace(aVar[j]);
      };
      

       

      Thanks