blob: c9694ca5c48ab23abb694f8284461e8be66234ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import com.oop.SelectionSystem;
class com.oop.GridSelectionSystem extends SelectionSystem
{
private var itemsPerRow:Number = 3;
private var currentRow:Number = 0;
private var currentColumn:Number = 0;
//space between rows and columns
private var horizSpace:Number = -6; //60;
private var vertSpace:Number = 0; //50;
public function GridSelectionSystem() {}
private function attachButtonItems():Void {
//get placement object according to counts
for (var i:Number = 0; i < systemData.length; i++) {
updateGrid(i);
var item:MovieClip = this.attachMovie(exportName, "Item_" + i, i );
item.init(this, i, systemData[i], getItemPositionObj());
listItems.push(item);
}
}
private function updateGrid(_index:Number) {
if(!(_index % itemsPerRow)) { currentColumn = 0; currentRow++; }
else { currentColumn++; }
}
private function getItemPositionObj():Object {
var obj:Object = new Object();
obj.horizSpace = horizSpace;
obj.vertSpace = vertSpace;
obj.grid_x = currentColumn;
obj.grid_y = currentRow;
return obj;
}
private function selectedData():MovieClip {
return systemData[ getCurrentSelection() ];
}
}
|