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

Listen 2D

Code Actionscript 2.0

Frame-Aktion

list = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "K"];
list = list.concat(["L", "M", "N", "O", "P", "Q", "R", "S", "T"]);
list = list.concat(["U", "V", "W", "X", "Y", "Z"]);
i = 0;
for (column = 0; column < 5; column = column + 1) {
for (row = 0; row < 5; row = row + 1) {
square.duplicateMovieClip("square" + i, i);
_root["square" + i]._x = 55 + row * 60;
_root["square" + i]._y = 55 + column * 60;
_root["square" + i].textfield.text = list[i];
i = i + 1;
}
}
// hide original
square._visible = 0;

Instanz-Aktion

on (rollOver) {
this._alpha = 20;
}
on (rollOut) {
this._alpha = 100;
}

Code Actionscript 3.0

var list:Array = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "K"]; list = list.concat(["L", "M", "N", "O", "P", "Q", "R", "S", "T"]); list = list.concat(["U", "V", "W", "X", "Y", "Z"]); var Squares:Array = new Array(); var i = 0; var myformat = new TextFormat(); myformat.font = "Font1"; // font must be embedded and exported for Actionscript for (var column = 0; column < 5; column = column + 1) { for (var row = 0; row < 5; row = row + 1) { Squares[i] = new squareObject(); Squares[i].x = 55 + row * 60; Squares[i].y = 55 + column * 60; Squares[i].textfield.embedFonts = true; Squares[i].textfield.setTextFormat(myformat); Squares[i].textfield.text = list[i]; Squares[i].name = "square"+i; Squares[i].addEventListener(MouseEvent.MOUSE_OVER, rollOver); Squares[i].addEventListener(MouseEvent.MOUSE_OUT, rollOut); this.addChild(Squares[i]); i = i + 1; }}// hide original square.visible = false; function rollOver(e:MouseEvent) { e.target.alpha = 0.2; if(e.target.name == "textfield") e.target.parent.alpha = 0.2; } function rollOut(e:MouseEvent) { e.target.alpha = 1; if(e.target.name == "textfield") e.target.parent.alpha = 1; }

Infos

Quadrate werden auf einem 5x5 Raster angeordnet. Die Variable i dient als Laufnummer der einzelnen Instanzen. Gleichzeitig ordnet sie die Textelemente aus dem Array list den jeweiligen Quadraten zu.

verwandt mit: Raster Anordnung, Listen Menu

Download

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


Share