Frame action
i = 1;
for (gx = 0; gx <= 8; gx = gx + 1) {
for (gy = 0; gy <= 8; gy = gy + 1) {
i = i + 1;
square0.duplicateMovieClip("square" + i, i);
this["square" + i]._x = gx * 50;
this["square" + i]._y = gy * 50;
this["square" + i]._xscale = 100 + random(50);
this["square" + i]._yscale = 100 + random(50);
}
}
square0._visible = 0;
var Squares:Array = new Array();
var i = 1;
for (var gx = 0; gx < 8; gx = gx + 1) {
for (var gy = 0; gy < 8; gy = gy + 1) {
i = i+1;
//important: square has to be exported for actionscript
//go to "linkage" in library menu
Squares[i] = new squareObject();
Squares[i].alpha = square0.alpha;
Squares[i].x = gx * 50;
Squares[i].y = gy * 50;
Squares[i].scaleX = 1 + Math.random()*0.5;
Squares[i].scaleY = 1 + Math.random()*0.5;
addChild(Squares[i]);
}
}
square0.visible = false;
A basic semitransparent element is arranged into an 8x8 grid structure. Using the random-function, each instance is assigned a different width and height between 50 and 150.
related to: Grid arrangement