Hey,
I’m trying to add button actions in a loop.
In the scene i have one empty movie clip.
The loop code in this MC clip looks like this
for (i=0; i<_root.myImagesTotal; i++) {
imageURL = _root.myImages*.attributes.url;
container_mc.duplicateMovieClip("container_mc"+i, this.getNextHighestDepth(), {_x:30, _y:50+i*220});
this["container_mc"+i]._xscale = 30;
this["container_mc"+i]._yscale = 30;
this["container_mc"+i].loadMovie(imageURL);
this["container_mc"+i].onRelease = function () {
trace(i);
}
}
It’s loads all the images OK but I can’t click them.
I swapped the .onRelease for this;
this.onPress = function () {
trace(i);
}
This makes the MC’s clickable but it always traces ‘6’ no matter which one I click.
I want to get ‘1’ when I click the first MC, ‘2’ when I click the second and so on.
Any suggestions?