Lists 2D

Code Actionscript 2.0

Frame action

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;

Instance action

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; }

Description

Squares are arranged into a 5x5 grid structure. The loop-variable i is the sequence number for the instances. At the same time, it assigns text elements from the 'list' array to be placed within the corresponding squares.

related to: Grid arrangement, List menu

Download

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


Share