6 Replies Latest reply on Oct 18, 2007 2:29 PM by kglad

    [AS2] assign function to mcs dynamically

    skot:317 Level 1
      Is there a way (using listeners, for loop, etc) to use the same function on multiple mcs - or, what's the most efficient way to do this:

      var ar_sq:Array = new Array(11,12,21,22);

      //Init squares on a grid
      for (i=0; i<ar_sq.length; i++) {
      k = ar_sq ;
      this["sq_"+k].selected = false;
      this["sq_"+k].onRollOver = sq_hover_on(this["sq_"+k]);
      this["sq_"+k].onRollOut = sq_hover_off(this["sq_"+k]);
      }

      I have multiple mcs that will have the same rollover functions, and I want to dynamically use the code on each mc.