1 Reply Latest reply on Apr 29, 2006 7:15 PM by shyaway

    Unique onPress for a number of buttons

      mmkay... sorry for the lame posts. Hopefully this one is more informed.

      I have an 8x8 grid of buttons - each 44 pixels wide and long. I want each button to behave differently when a user clicks it.

      I have this code...

      (note that I use depth as intended but it also serves as a unique naming convention.)

      arr[0] = new Array();
      arr[0][0] = "buttonGrid00";
      arr[0][1] = "buttonGrid01";

      //etc... up to [7][7]

      for (y=0; y<=7; y++) {
      currX = 0;
      for (g=0; g<=7; g++) {
      depth = (y*10)+g;
      butt[depth]= _root.attachMovie(arr[y][g],depth,depth);
      butt[depth].onPress = function(){
      currX = currX+44;
      currY = currY+44;

      Ok... the problem is that when I click on any button it gives me the name of the LAST button placed. So if I click button 00, I always get button 77. Any ideas?