How do I create pages of thumbnails based on a total image count?
I’m using a loop to populate an image holder mc, (imageHolder) I create 80 (arbitrary) empty movie clips and push them into a large array. That part works fine.
Using the length of the large array (newImages), I loop through the clips in that to shift the larger array into smaller ones, incrementally named (pgArray). Since imagesPerPage is 10, I expected to have 10 arrays that contained the empty mcs, but something has gone wrong. Here’s my pagination function:
function cullArray():Void {
trace("cullArray called");
var allImgCount:Number = newImages.length;
for (var k:Number = 0; k < Number(allImgCount / imagesPerPage); k++) {
var pgArrayName:String = String("pageArray" + k);
var pgArray:Array = [];
for (var j:Number = 0; j < imagesPerPage; j++) {
var img:Object = newImages.shift();
trace("img name: " + img);
pgArray.push(img);
}
trace("Here are the images on the " + k + "st page" + " (" + String(pgArrayName) + ")
");
trace(" " + pgArray);
}
trace("cullArray ended");
}
Can someone help me out? I think I’m referencing the strings and the arrays incorrectly. Thanks!
I found a solution after a while, but it probably needs cleaning up: