blob: 2c89bf0f0d8a58a0e8237453012b0f7dff3e9538 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
/*
Manages a set of UI Buttons and controls selection state
*/
class com.oop.SelectionSystem extends MovieClip
{
//----------------------------------------------------------------------------------
// Data array passed in at instantiation
private var systemData:Array;
// Linkage name of button clip
private var exportName:String;
// Store our current state as a number
private var currentSelection:Number;
// Store references to our items
private var listItems:Array;
//----------------------------------------------------------------------------------
public function SelectionSystem()
{
}
//----------------------------------------------------------------------------------
public function doInit(_systemData:Array, _exportName:String):Void
{
systemData = _systemData;
exportName = _exportName;
listItems = new Array();
attachButtonItems();
}
public function setSelection(_id:Number):Void
{
if(currentSelection!=_id)
{
listItems[currentSelection].setUnselected();
currentSelection = _id;
listItems[currentSelection].setSelected();
doAction();
}
}
private function attachButtonItems():Void {
//override
}
private function doAction():Void
{
//override
}
// Getter/setters
public function getSystemData():Array
{
return systemData;
}
public function getCurrentSelection():Number
{
return currentSelection;
}
public function setCurrentSelection(_val:Number):Void
{
currentSelection = _val;
}
}
|