summaryrefslogtreecommitdiffstats
path: root/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_buttons.txt
blob: b3d07ffeda43e216ed00bbdd59a62c8db6a316ad (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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
var btnptr = null;



var bHeight = blank._height;

var additionalVSpace = 1;

var clickedButton = 0;



var totalSteps = _root.AnswerArray[_root.AnswerArray.length - 1][0].stepnum;



_root.ShowMe._visible = false;





populateTopic();

menuInitialize();



//making the first step as default

_root.stepnum = 0;

_root.showInstruction(_root.stepnum);

_root.loadImage(_root.stepnum,null); // no previous image

clickedButton = _root.stepnum;

//eval("blank.buttonlist.step" + _root.stepnum).gotoAndStop(2);





// initialize device select buttons

//initializeDeviceButtons();

function initializeDeviceButtons()

{

    /* Don't run this function since we don't have any more devices to initialize...

    Dont't waste CPU cycles

    device0.deviceName = routerInfoArray[0].hostName;

    device0.deviceNum = 0;

    device0.gotoAndStop(2);



    for (var i=1; i<routerInfoArray.length; i++)

    {

        device0.duplicateMovieClip("device" + i, 6000 + i);

        eval("device" + i).deviceName = routerInfoArray[i].hostName;

        eval("device" + i).deviceNum = i;

        eval("device" + i)._x = device0._x + device0._width * i;

    }

    */

}







function menuInitialize()

{

    var numOfSteps = AnswerArray.length - 1;



    // if we have more than 24 buttons, we have to allow for scroll, otherwise turn it off

    if (totalSteps <= 15)

        scrollDisable();



    blank.buttonlist.attachMovie("stepblock","stepblock","8000");



    // miwang

    AnswerArray[0][0].stepnum = 0;

    var j = 0;

    blank.buttonlist.attachMovie("step","step" + j, j);

    eval("blank.buttonlist.step" + j).text = j;

    eval("blank.buttonlist.step" + j).num = 0;

    eval("blank.buttonlist.step" + j)._y = j * (eval("blank.buttonlist.step" + j)._height + additionalVSpace);

    j++;



    for (i = 1; i <= numOfSteps; i++)

    {

trace("i=" + i + ", j=" + j);

        // miwang

        // if step number is different from the previous element's, then add new button

        if (AnswerArray[i][0].stepnum != AnswerArray[i-1][0].stepnum)

        {

            blank.buttonlist.attachMovie("step","step" + j, j);

            eval("blank.buttonlist.step" + j).text = j;

            eval("blank.buttonlist.step" + j).num = i;



            eval("blank.buttonlist.step" + j)._y = j * (eval("blank.buttonlist.step" + j)._height + additionalVSpace);



            j++;

        }

    }



    _root.coverButton(0);

  /*

  additionalHSpace = 12;

  for (i = 0; i <= totalSteps; i++)

  {

    // Once we hit 24, we need to start a new column of buttons

    if (i == 24)

    {

      bHeight = 0;

    }



    if (i < 24)

    {

      blank.attachMovie("step", "step" + i, i);

      eval("blank.step" + i).text = i;



      eval("blank.step" + i)._y = bHeight;

      bHeight = blank._height + additionalVSpace;

    }

    else

    {

      blank.attachMovie("step", "step" + i, i);

      eval("blank.step" + i).text = i;



      eval("blank.step" + i)._y = bHeight;

      bHeight += eval("blank.step" +i)._height + additionalVSpace;

      eval("blank.step" + i)._x = additionalHSpace;

    }

  }

  */

}



function scrollDisable()

{

    blank.scrollUp._visible = false;

    blank.scrollDown._visible = false;

    blank.scrollbar._visible = false;

}



function stepscrollUp()

{

//trace("buttonlist _y = " +blank.buttonlist._y);

//trace("buttonlist _height = " + blank.buttonlist._height);

//trace("buttonlist _y + _height = " + (blank.buttonlist._y + blank.buttonlist._height));



//trace("blank _y = " +blank._y);

//trace("blank _height = " + blank._height);

//trace("blank _y + _height = " + (blank._y + blank._height));

      if (blank.buttonlist._y <= -12)

      {

        blank.buttonlist._y = blank.buttonlist._y + 12;

        step_setSlider(blank.buttonlist);

      }

}



function stepscrollDown()

{

//trace("buttonlist _y = " +blank.buttonlist._y);

//trace("buttonlist _height = " + blank.buttonlist._height);

//trace("buttonlist _y + _height = " + (blank.buttonlist._y + blank.buttonlist._height));



trace("blank _y = " +blank._y);

trace("blank _height = " + blank._height);

trace("blank _y + _height = " + (blank._y + blank._height));



    if (blank.buttonlist._y +blank.buttonlist._height > 259)

    {

        blank.buttonlist._y = blank.buttonlist._y - 12;

        step_setSlider(blank.buttonlist);

    }

}



function step_setScroll(slider)

{

  //trace("Y = " +slider._y);





  _root.blank.buttonlist._y = (1-(slider._y/450) * (_root.blank.buttonlist._height-271.4));

  trace("buttonlist Y = " + _root.blank.buttonlist._y);

}



function step_setSlider(buttonlist)

{

  //trace("Y = " +slider._y);

  //trace("buttonlist Y = " + _root.menu.buttonlist._y);



  _root.blank.scrollbar.slider._y = (425 * ((Math.abs(_root.blank.buttonlist._y))/(_root.blank.buttonlist._height-271.4)));

  trace("buttonlist._y = " + _root.blank.buttonlist._y);

  trace("buttonlist._height = " + _root.blank.buttonlist._height);

  trace("scrollbar slider._y = " + _root.blank.scrollbar.slider._y);

  trace("scrollbar._height = " + _root.blank.scrollbar._height);

}



function stepClick(text)

{

    // reset the matrix check array

    matrix = null;

    var prevStep = _root.stepnum; // THIS is important for remembering the previous step.



    //check to see if he has clicked on the same step

    i = Number(text);

    if (_root.stepnum == i)

    {

        matrix = null;

        _root.showInstruction(_root.stepnum);

        return;

    }

    clickedButton = i;

    _root.stepnum = i;



    //begin loading the images is done here

    _root.loadImage(_root.stepnum, prevStep);

    //end loading the images is done here



    //check to see if the answer button is clicked if so then display the answer

    if (showAns == true)

    {

        //if it step zero then reset everything

        if (i > 0)

        {

            showAnswer(i);

        }

        else

        {

            _root.showInstruction(_root.stepnum);

            answerInitialize(false);

            _root.exitRouter();

            _root.menu.DoneButton.gotoAndPlay("Show");

            showAns = false;

            _root.ShowMe._visible = false;



            // miwang

            _root.coverButton(0);

        }

    }

    else

    {

        _root.goToNextStep(_root.stepnum, prevStep);



        //add for step 0

        _root.showInstruction(_root.stepnum);

        if (_root.stepnum == 0)

        {

            _root.exitRouter();

        }

        else

        {

            var rptr = eval("_root.r" + _root.VISIBLE_ROUTER);

            rptr.lineIndexCounter = 0;



            _root.commandline_setMode(_root.stepModeArray[_root.stepnum], _root.active_router);

            output_write("\n");

            _root.commandline_changeProcess("commandline_processCommandLine");

            _root.commandline_commandLine();

        }

    }

}



function coverButton(step)

{

    blank.buttonlist.stepblock._visible = true;

    blank.buttonlist.stepblock._x = eval("blank.buttonlist.step" + step)._x;

    blank.buttonlist.stepblock._y = eval("blank.buttonlist.step" + step)._y;

    blank.buttonlist.stepblock.text = step;

}



function stepRollOver()

{

/*

  x = _xmouse;

  y = _ymouse;



  for (i = 0; i <= totalSteps; i++)

  {

    found = eval("blank.buttonlist.step" + i).hitTest (x, y, false);

    if (found)

    {

      eval("blank.buttonlist.step" + i).gotoAndStop(2);

    }

  }

  */

}









function stepRollOut()

{

/*

  x = _xmouse;

  y = _ymouse;



  for (i = 0; i <= totalSteps; i++)

  {

    found = eval("blank.buttonlist.step" + i).hitTest (x, y, false);

    if (!found)

    {

      if (i != clickedButton)

        eval("blank.buttonlist.step" + i).gotoAndStop(1);

    }

  }

  */

}





function exitRouter()

{

    // normal exit

    var r = eval("_root.r" + _root.active_router);

    output_write("\n");

    r.userHistory = new Array();

    r.configHistory = new Array();

    _root.commandline_changeProcess("router_startup_processStartUp");

    eval("_root.r" + _root.active_router + ".router_startup") = false; // forcing to be restarted

    router_startup_checkStartUp();

    _root.disableAllSteps()

}





function disableAllButtons()

{

/*

  for (i = 1; i <= totalSteps; i++)

  {

      eval("blank.buttonlist.step" + i)._visible = false;

  } */

  blank.buttonlist.stepblock._visible = false;

}





function populateTopic()

{

    _root.menu.topicCovered = _root.chapterCovered ;

    if (_root.wantShowTopology == false)

        _root.menu.TopologyButton._visible = false;



}