1 Reply Latest reply on Jan 28, 2011 10:10 PM by kglad

    Making dynamic listeners into a for (?)

    Regalado Montoya

      HI, I have a bunch od images that needs to be loaded and clicked. To do that, i'm using a listener object so when the images are loaded they can be clicked, and that works. But, at the end of the "for" only the last image can be clicked. I'm trying to make a different listener for each image, is this ok? Please, help.

       

       

      var nn = "image"+j;

       

      _root.createEmptyMovieClip(nn, getNextHighestDepth());

      _root[nn]._x = (random(1700))+40;

      _root[nn]._y = (random(350))+40;

       

       

      this["image_mcl"+j] = new MovieClipLoader();

       

      this["mclListener"+j] = {};

      this["mclListener"+j].onLoadComplete = function() {

      _root[nn].onPress = function() {

              trace("click!");

          };

      };

       

      this["image_mcl"+j].addListener(this["mclListener"+j]);

      this["image_mcl"+j].loadClip("buildings/"+imgs[j].attributes.ruta, _root[nn]);