I have a function that contains a loop on my main timeline. The result is a lot of pictures being loaded. This works fine on faster connections but on dialup you have to wait until all the pictures are loaded up before any of my buttons on the site work. My button functions are also defined in the same code as the loop function (which is shown below). Is there a way so that I can break this loop while its running if any of my buttons are pressed so that their function work? Will on release scripts attached to buttons objects respond while this loop is running? Can you do it within this loop so that if any button is pressed it breaks?
function drawGrid(container, wide) {
clearExistingGrid(container);//if any
var x = 0;
while (x<myLv.n) {
for (var y = 0; y<wide; y++) {
if (x>=myLv.n) {
break;
}
new_mc = container.attachMovie("grid_item", "mc_"+x, x);
if (x%wide == 0) {
new_mc._x = startPozX;
} else {
new_mc._x = startPozX+(new_mc._width+spaceX)*(x%wide);
}
if (Math.floor(x/wide) == 0) {
new_mc._y = startPozY;
} else {
new_mc._y = startPozY+(new_mc._height+spaceY)*(Math.floor(x/wide));
}
new_mc.price.text = "£"+myLv["price"+(x)]+"";
new_mc.modelNum.text = myLv["model"+(x)];
new_mc.photoContainer.loadMovie(myLv["pic"+(x)]);
new_mc.movnum = x
x++;
}
}
}