-
Notifications
You must be signed in to change notification settings - Fork 0
/
consoleactions.as
98 lines (73 loc) · 3.38 KB
/
consoleactions.as
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
90
91
92
93
94
95
96
97
98
class consoleactions{
static var hoverRGB:Array = new Array(110, 15, 5);//(58, 116, 190);
static var timeNeedToPressButton:Array = new Array(.1, .5, .8, 1, 1.35, 1.5);
static function init (){
if (_root.console == undefined)
_root.console = _root.attachMovie('console', 'console', 0);
var ActionConsole = _root.console;
ActionConsole._x = 440; ActionConsole._y = 0;
ActionConsole.items = new Array();
ActionConsole.onMouseMove = function (){
}
ActionConsole.onEnterFrame = function (){
}
ActionConsole.pid = 0;
ActionConsole.spawnGUIelement = function (guielementtype, X, Y):MovieClip{
++this.pid;
var newGUI = this.attachMovie(guielementtype, guielementtype + '_' + this.pid, this.getNextHighestDepth());
newGUI._x = X; newGUI._y = Y; newGUI.gotoAndStop(1);
this.items.push(newGUI);
return newGUI;
}
ActionConsole.spawnButton = function (X, Y, wid, buttonName, buttonDescription, action, multiplePressingAvailable){
if (X == 'default') X = 10;
if (Y == 'default') Y = 200;
if (wid == 'default') wid = 180;
if (buttonDescription == 'default') buttonDescription = buttonName;
if (multiplePressingAvailable == undefined) multiplePressingAvailable = false;
var newButton = this.spawnGUIelement('console_button', X, Y);
newButton.itemName = buttonName;
newButton.requiredWidth = wid;
newButton.nedUpd = true;
newButton.action = action;
newButton.multiplePressingAvailable = multiplePressingAvailable;
}
ActionConsole.spawnCheckBox = function (X, Y, wid, checkboxName, checkboxDescription, checked, action){
if (X == 'default') X = 10;
if (Y == 'default') Y = 200;
if (wid == 'default') wid = 180;
if (checkboxDescription == 'default') checkboxDescription = checkboxName;
if (checked == 'default') checked = false;
var newCheckBox = this.spawnGUIelement('console_checkbox', X, Y);
newCheckBox.itemName = checkboxName;
newCheckBox.requiredWidth = wid;
newCheckBox.requiredCheck = checked;
newCheckBox.nedUpd = true;
newCheckBox.action = action;
}
ActionConsole.spawnTrackBar = function (X, Y, wid, trackbarDescription, action, minValue, maxValue, stepValue, currentValues){
if (X == 'default') X = 10;
if (Y == 'default') Y = 200;
if (wid == 'default') wid = 180;
if (minValue == undefined) minValue = 0;
if (maxValue == undefined) maxValue = 1;
if (stepValue == undefined) stepValue = 1;
if (currentValues == undefined) currentValues = 0;
var newTrackBar = this.spawnGUIelement('console_trackbar', X, Y);
newTrackBar.requiredWidth = wid;
newTrackBar.requiredValueChange = action;
newTrackBar.requiredValues = new Array(minValue, maxValue, stepValue, currentValues);
newTrackBar.nedUpd = true;
}
ActionConsole.spawnTest = function (){
for (var i = 0; i < 1; ++i)
this.spawnButton('default',50 + i * 17,'default','oka y ' + i,'this is just okay button', doNothing, random(2)==0)
for (var i = 0; i < 1; ++i)
this.spawnCheckBox('default',101 + 12 * i,'default',' on '+i+'/ off','this is just okay checkbox', !random(2), doNothing2)
this.spawnTrackBar('default',151 + 12,'default', 'no', doNothing2, 20, 100, 10, 50);
this.spawnTrackBar('default',151 + 36, 10, 'no', doNothing2);
}
}
static function doNothing (){trace('Nothing happened.');}
static function doNothing2 (S){trace('Nothing happened. ' + S);}
}