Duplicate, combined 2

Code Actionscript 2.0

Frame action

for (i = 1; i < 50; i = i + 1) {
square0.duplicateMovieClip("square" + i, i);
this["square" + i]._rotation = 1.2 * i;
this["square" + i]._xscale = 8 * i;
this["square" + i]._yscale = 300 - 6 * i;
this["square" + i]._alpha = 10 * (i % 10);
}
square0._visible = 0;

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 = 1.2 * i; Squares[i].scaleX = 0.08 * i; Squares[i].scaleY = 3 - 0.06 * i; Squares[i].alpha = 0.1 * (i % 10); addChild(Squares[i]); } square0.visible = false;

Description

The instance square0 is duplicated 49 times. Every time square0 is copied, the properties rotation, xscale, yscale and the opacity alpha are modified. The change is calculated from the loop-variable i.

Download

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


Share