Duplicate and rotate

Code Actionscript 2.0

Frame action

for (i = 1; i < 50; i = i + 1) {
square0.duplicateMovieClip("square" + i, i);
this["square" + i]._rotation = 4.7 * i;
}

Code Actionscript 3.0

var Squares:Array = new Array(); var i = 1; for (i=1; i<50;i = i + 1) { //important: square has to be exported for actionscript //go to "linkage" in library menu Squares[i] = new squareObject(); Squares[i].x = square0.x; Squares[i].y = square0.y; Squares[i].rotation = 4.7 * i; addChild(Squares[i]); }

Description

The instance square0 is duplicated 49 times. Every time square0 is copied, the rotation is increased continuously. The change is calculated from the loop-variable i. Note that the pivot of the rotation has to be on the corner of the square.

Download

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


Share