NEU: Alle Visual Codes als Code Snippets für Flash CS5:
jetzt hier downloaden .

Raster Anordnung

Code Actionscript 2.0

Frame-Aktion

i = 1;
for (gx = 1; gx < 9; gx = gx + 1) {
for (gy = 1; gy < 9; gy = gy + 1) {
i = i + 1;
square0.duplicateMovieClip("square" + i, i);
this["square" + i]._width = 25;
this["square" + i]._height = 25;
this["square" + i]._x = 20 + gx * 40;
this["square" + i]._y = 20 + gy * 40;
}
}
square0._visible = 0;
// hide original, only work with copies

Code Actionscript 3.0

var i=1; var Squares: Array = new Array(); var gx = 1; var gy = 1; square0.visible = false; for (gx = 1; gx < 9; gx = gx + 1) { for (gy = 1; gy < 9; 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].width = 25; Squares[i].height = 25; Squares[i].x = 20 + gx * 40; Squares[i].y = 20 + gy * 40; addChild(Squares[i]); } }

Infos

Dieses Skript erzeugt eine rasterartige Anordnung mit Hilfe von zwei verschachtelten for-Schleifen für die horizontale und die vertikale Position. Die Variable i dient hier als Laufnummer der einzelnen Instanzen. Im Gegensatz zu gx und gy, die die Werte von 1 bis 9 mehrfach durchlaufen, weist die Variable i jeder Instanz eine eindeutige Nummer zu.

Download

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


Share