8 Replies Latest reply on Apr 21, 2006 4:41 PM by kglad

    dynamically passing an argument to a function

    Level 7
      If I dynamically place a series of movieclips using a loop:

      for(var i=0;i<myArray.length;i++)
      eval("b"+i).onPress=function(){myFunction(myArray )};

      then as a reult an attempt to Press any of these movieclips results in
      passing the same argument
      I.e. the value of i at the end of the loop is passed to every clip.

      How do I get round this and secure that the onPress function on clip No i is
      given myArray
      as the parameter?