3 Replies Latest reply on May 3, 2008 8:53 PM by rlc5611

    buttons in arrays - no action

    Sunnyspring
      I have 36 buttons I need action on. To avoid a lot of similar commands, I am trying to assign the button names in an array using a for loop. Tracing the array values, gives the correct button names, but there is no action when I press the buttons. If anyone can tell me the reason, I would really appreciate it. Thanks in advance!

      Here is the code:

      var farge_btn_tbl:Array = new Array(4); // Array assigning button instance names (works fine)
      var farge_fr_tbl:Array = new Array(4); // Array assigning frame label names (works fine)


      for (var i:Number = 0; i < 4; i++) {
      farge = "farge" + String(i+1); // The button instance names are assigned
      farge = "fargen" + String(i+1); // The frame label names are assigned
      farge_btn_tbl = farge; // Placing the values in the button array
      farge_fr_tbl
      = fargen; // Placing the values in the frame array
      farge.onRelease = function(){ // Trying to get action on the buttons
      gotoAndStop(fargen + String(i+1)); // it doesn't work
      }
      }