summaryrefslogtreecommitdiffstats
path: root/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_utility.txt
blob: 5cc85ac48f6df7454a3a97b5d288fd61229c3308 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//zmg, 03.01.01

//this file needs a better description!

//

//











// Utility functions









// FIle: actions_misc.txt

// Description: Miscellenous functions





// utility_hideAll()

// IN : None

// DO : Hide all unutilized movie clips

// OUT: None

function utility_hideAll() {

	_root.Instructions._visible = false;

	_root.Topology._visible = false;

	_root.Done._visible = false;

}









// utility_updateText()

// IN : None

// DO : Updates text for Menu buttons (i.e. hide/show instructions, toplogy, done)

// OUT: None

function utility_updateText() {





	tellTarget("Menu") {



		instructiontext = "Show Instructions";

		topologytext = "Show Topology";

		donetext = "Show Done";

	}

}









// utility_setVisible(b)

// IN : The router object that is to be set

// DO : Sets visibility of buttons for Routers and the screen

// OUT: None

function utility_setVisible(b) {



	// set the visibility of the router's menu button to true

	with(eval("_root.Menu.m" + b)) {

		_visible = true;

	}



	// set the visibility of the router's hyperterminal to false

	with(eval("_root.HyperTerminal.s" + b)) {

		_visible = false;

	}

}









// ***** utility_randomMAC() *****

// IN : None

// DO : Calculates a random 12-digit MAC address in the following hex format:

//		0060.5cf4.c677

// OUT:	Returns the random address generated

function utility_randomMAC() {





	// an array of possible hex numerals

	var hex = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");



	var mac = ""; // container for the random address



	// pull 12 random elements out of the hex array

	// put a '.' seperator between each group of four

	for (var i=0; i<12; i++)

	{

		mac += hex[Math.round(Math.random()*15)];



		// adding the '.' seperator after the 4th and 8th numerals

		if(i == 3 || i == 7)

			mac += ".";

	}



	return mac;

}







function utility_switchToNewRouter() {



	//the visible router isnt telnetted anywhere,

	//switch over to this new router like normal



	// turning on the correct router

	if (BUTTONROUTER == "RouterA") {



		// turn visibility to nil

		_root.Menu.mRouterA._visible = false;

		_root.HyperTerminal.sRouterA._visible = true;

		_root.utility_setVisible(_root.VISIBLE_ROUTER);



 		_root.active_router = "RouterA";

		_root.VISIBLE_ROUTER = "RouterA";

		_root.utility_hideAll();

		_root.utility_updateText();



		_root.router_startup_checkStartUp();

		_root.output_setCursor();



	} else if (BUTTONROUTER == "RouterB") {

		// turn visibility to nil

		_root.Menu.mRouterB._visible = false;

		_root.HyperTerminal.sRouterB._visible = true;

		_root.utility_setVisible(_root.VISIBLE_ROUTER);



		_root.active_router = "RouterB";

		_root.VISIBLE_ROUTER = "RouterB";

		_root.utility_hideAll();

		_root.utility_updateText();



		_root.router_startup_checkStartUp();

		_root.output_setCursor();



	} else if (BUTTONROUTER == "RouterC") {

		// turn visibility to nil

		_root.Menu.mRouterC._visible = false;

		_root.HyperTerminal.sRouterC._visible = true;

		_root.utility_setVisible(_root.VISIBLE_ROUTER);



		_root.active_router = "RouterC";

		_root.VISIBLE_ROUTER = "RouterC";

		_root.utility_hideAll();

		_root.utility_updateText();



		_root.router_startup_checkStartUp();

		_root.output_setCursor();



	} else if (BUTTONROUTER == "RouterD") {

		// turn visibility to nil

		_root.Menu.mRouterD._visible = false;

		_root.HyperTerminal.sRouterD._visible = true;

		_root.utility_setVisible(_root.VISIBLE_ROUTER);



		_root.active_router = "RouterD";

		_root.VISIBLE_ROUTER = "RouterD";

		_root.utility_hideAll();

		_root.utility_updateText();



		_root.router_startup_checkStartUp();

		_root.output_setCursor();



	} else if (BUTTONROUTER == "RouterE") {

		// turn visibility to nil

		_root.Menu.mRouterE._visible = false;

		_root.HyperTerminal.sRouterE._visible = true;

		_root.utility_setVisible(_root.VISIBLE_ROUTER);



		_root.active_router = "RouterE";

		_root.VISIBLE_ROUTER = "RouterE";

		_root.utility_hideAll();

		_root.utility_updateText();



		_root.router_startup_checkStartUp();

		_root.output_setCursor();

	}



}