I have a loop that dynamically loads thumbnails into a movie clip. As each thumb is loaded, it calls on a preloader function. This works for all the thumbs except the first one! No matter which one is the first one, it won’t work on the first thumb.
The code is as follows:
function makeButtons() {
tnNr = 0;
clearInterval(delay);
for (var i = 0; i<tArray.length; i++) {
var thb = main_thumbs_mc.thumbClip.duplicateMovieClip("thmb"+i, 1000+i);
thb.id = i;
thb._x = 10+(i%5*118);
thb._y = 20+(Math.floor(i/5)*137);
}
loadButtons();
}
function loadButtons() {
var tbox = main_thumbs_mc["thmb"+tnNr].thumbEmpty;
trace(tbox);
tbox.loadMovie(tArray[tnNr]);
tbox._parent.preLoader();
temp = this.createEmptyMovieClip("tmp"+tnNr, 999);
temp.onEnterFrame = function() {
bt = tbox.getBytesTotal();
bl = tbox.getBytesLoaded();
if (bt == bl && bt>4) {
tbox._x += (tbox._parent._width-tbox._width)/2;
tbox._y += (tbox._parent._height-tbox._height)/2;
nextButton();
delete this.onEnterFrame;
}
};
}
the part that
says “tbox._parent.preLoader” is where the preloader is called, and I placed a trace() command in the preloader and it traces on every thumb except the first one. I thought maybe it was because it had an instance of 0, so I assigned tnNr a value of 1 and I also tried 5. And same thing. The first thumb (In this case, the second one or 6th one) did not load the preloader.
IS there something wrong with the code? Anyone have any ideas why this might be?
thanks a bunch.