I’m making a gallery. I’m only at the beginning of doing so but I’m having a problem passing variables into the onLoadInit function.
for (var i = 0; i<nTotalPics; i++) {
main.createEmptyMovieClip( "container"+i, i );
var container:MovieClip = main["container"+i];
container.createEmptyMovieClip( "pic"+i, i );
var pic:MovieClip = container["pic"+i];
// load images
mcl.loadClip( astrImages*, pic, i );
// Thumbnail structure // USED to be pic. , now it's container.
container._x = (i%columns)*thumbWidth;
var newRow = Math.floor(i/columns);
container._y = newRow * thumbHeight;
}
// when the image finishes loading
mclListener.onLoadInit = function(pic:MovieClip){
**main.container3.createTextField("txtQuan", 1, 0, 100, 80, 20);
var txtQuan:TextField = main.container3.txtQuan;**
txtQuan.text = "How many : ";
}
// add the listener to the MovieClipLoader Object
mcl.addListener(mclListener);
The code I’m having an issue with is in bold. After the images have been loaded I want to add a TextField underneath them.
Why can’t I use the “i” value from the for loop to create textfields. I want to do this: **main[“container”+i].createTextField(“txtQuan”, 1, 0, 100, 80, 20); . **Why can’t I do this? I’m a little lost when it comes to listeners.
Thanks for any ideas you have.