7 Replies Latest reply on Apr 26, 2006 1:15 PM by kglad

    add OnPress function to dynamically-created movieclips

    jcane1 Level 1
      I am able to dynamically generate movieClips in a loop. However, I wish to enable each of those duplicated movie clips to have an onPress function. Can that be done? If so, how?

      relevant code:
      button.onPress = function() { // button is clicked, revealing parent movieClip which will contain duplicated child movieClips
      parent_mc._visible = true;
      for (var i:Number = 0; i < 8; i++) {
      var clip:MovieClip = parent_mc.child_mc.duplicateMovieClip("child_mc"+i; i);
      clip.loadMovie(image_arr ); // each new movieClip loads a picture referenced in the array

      Can onPress functionality be added to each new clip? I'd like each picture to be clickable so that clicking a picture invokes another function.