Grid with rotation

Code Actionscript 2.0

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]._rotation = 0.6 * i;
}
}
square0._visible = 0;

Code Actionscript 3.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].x = gx * 50; Squares[i].y = gy * 50; Squares[i].rotation = 0.6*i; addChild(Squares[i]); } } square0.visible = 0;

Description

A basic element is arranged into an 8x8 grid structure. Every time square0 is copied, its rotation increases by the value of the loop-variable i.

related to: Grid arrangement

Download

Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File


Share