Revision: 25742
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 7, 2010 15:24 by jknight42
Initial Code
// This code should be placed in a for loop of some sort
// that iterates through each of your images or display objects.
//
if(iNum==0) {
// place the first image at 0,0
currX = 0;
currY = 0;
} else if(iNum%2 == 0) {
// Change "2" to however many columns this grid should have.
// This runs anytime iNum is evenly divisible by 2
// Which sets currX to 0 and adds another row height to currY
// Essentially starting a new row.
currY += _imageHeight + _imageSpacing;
currX = 0;
} else {
currX += _imageWidth + _imageSpacing;
}
images[i].x = currX;
images[i].y = currY;
Initial URL
http://www.cannedbanners.com
Initial Description
This code will arrange any number of images (or display objects) in a grid, you can specify how many columns the grid contains.
Initial Title
Arrange images (or anything) in a grid
Initial Tags
images
Initial Language
ActionScript 3