home *** CD-ROM | disk | FTP | other *** search
- function desactivateButton()
- {
- varx = algoToFreezeButton.charAt(0);
- vary = algoToFreezeButton.charAt(1);
- i = 1;
- while(nb_Answer >= i)
- {
- _root["C" + varx + "_" + vary]["D" + varx + vary + "_" + i].gotoAndStop("done");
- i++;
- }
- }
- function getNextQuestion()
- {
- if(testNo < 4)
- {
- testNo++;
- }
- else
- {
- _level0.TestIsDone = 4;
- _level0.saveUserData();
- loadMovieNum("InstructionPosttest.swf",34,"GET");
- }
- isPostest = 0;
- testToLoad = _root.Question[testno];
- myData.loadVariables(getFile("test",testToLoad));
- myData.myFrame = "algorithm";
- myData.smallPict = getFile("pictS",testToLoad);
- myData.largePict = getFile("pictL",testToLoad);
- Qflashed = false;
- }
- function turn(toState, objArray1, objArray2, objArray3, objArray4, objArray5)
- {
- var i = 0;
- while(i < objArray1.length)
- {
- objArray1[i].gotoAndStop(toState);
- i++;
- }
- var i = 0;
- while(i < objArray2.length)
- {
- objArray2[i].gotoAndStop(toState);
- i++;
- }
- var i = 0;
- while(i < objArray3.length)
- {
- objArray3[i].gotoAndStop(toState);
- i++;
- }
- var i = 0;
- while(i < objArray4.length)
- {
- objArray4[i].gotoAndStop(toState);
- i++;
- }
- var i = 0;
- while(i < objArray5.length)
- {
- objArray5[i].gotoAndStop(toState);
- i++;
- }
- if(toState == "off")
- {
- mc_mainFeedback.gotoAndStop(1);
- }
- }
- function getFile(type, ID)
- {
- var file = "";
- if(type == "info")
- {
- file = "_data/algorithm/getAlgorithmInfo_" + ID + ".txt";
- }
- if(type == "test")
- {
- file = "_data/algorithm/getAlgorithmInfo_F" + ID + ".swf";
- }
- if(type == "pictS")
- {
- file = "_media/algorithm/T/imgs_0" + ID + ".swf";
- }
- if(type == "pictL")
- {
- file = "_media/algorithm/T/imgL_0" + ID + ".swf";
- }
- return file;
- }
- function getInfoDataFile(infoBtn)
- {
- return "_data/algorithm/getAlgorithmInfo_" + infoBtn._name + ".txt";
- }
- function getFeedbacks(classDisease)
- {
- }
- function setThumbPict(dropzone)
- {
- dropzone.loadMovie(myData.smallPict);
- }
- function setZoomPict(dropzone)
- {
- dropzone.loadMovie(myData.largePict);
- }
- function showInfo(button)
- {
- var ID = button._name;
- if(ID != "mc_help")
- {
- var mPath = "_media/algorithm/" + ID.charAt(0) + "/";
- var frame = "info" + ID.charAt(0);
- var dataFile = getFile("info",ID);
- }
- else
- {
- var mPath = "help";
- }
- _level0.algorithmInf = {myCaller:_root,myFrame:frame,myMoviePath:mPath,myDataFile:dataFile};
- loadMovieNum("algorithmInf.swf",50,"GET");
- }
- function showFeedback(button)
- {
- if(_root.isTestMode)
- {
- var btnNo = Number(button._name.split("_")[1]);
- var rightAnswer = btnNo == Number(myData.ID[1]);
- if(_root.BtnClicked2[_root.testno][btnNo] != 1)
- {
- _root.counter_choice2 = _root.counter_choice2 + 1;
- if(RightAnswer == true and _level0.Algo_Question_Done2[_root.testno] != 1)
- {
- _root.BtnClicked2[_root.testno][btnNo] = 1;
- _level0.Algo_Question_Done2[_root.testno] = 1;
- _level0.User_Choice_Algo2[_root.testno][_root.counter_choice2] = btnNo;
- _level0.saveTestData();
- }
- if(_root.counter_choice2 < _root.nb_Answer and _level0.Algo_Question_Done2[_root.testno] != 1)
- {
- _root.BtnClicked2[_root.testno][btnNo] = 1;
- _level0.User_Choice_Algo2[_root.testNo][_root.counter_choice2] = btnNo;
- _level0.saveTestData();
- }
- }
- mc_feedback.title = filter(button.text,"\r");
- mc_feedback.text = myData["D" + btnNo];
- mc_feedback.gotoAndStop(!rightAnswer ? "wrong" : "right");
- }
- }
- function filter(str1, str2, maxChr)
- {
- str2 = str1.split(str2);
- str1 = "";
- var n = 0;
- while(n < str2.length)
- {
- str1 += str2[n] + " ";
- n++;
- }
- str1 = str1.substr(0,str1.length - 1);
- if(typeof maxChr != "undefined")
- {
- str1 = str1.substr(0,maxChr) + "...";
- }
- return str1;
- }
- function replace(str, str1, str2)
- {
- var string = "";
- var index = str.indexOf(str1);
- while(-1 < index)
- {
- string += str.substr(0,index) + str2;
- str = str.substr(index + str1.length,str.length);
- index = str.indexOf(str1);
- }
- string += str;
- return string;
- }
- function addToButtonList(btnMC)
- {
- var n = 0;
- found = false;
- if(typeof buttonList == "undefined")
- {
- buttonList = [];
- }
- while(!found && n < buttonList.length)
- {
- found = buttonList[n] == btnMC;
- n++;
- }
- if(!found)
- {
- buttonList.push(btnMC);
- }
- }
- function removeFromButtonList(btnMC)
- {
- var n = 0;
- while(n < buttonList.length)
- {
- if(buttonList[n] == btnMC)
- {
- buttonList.splice(n,1);
- break;
- }
- n++;
- }
- }
- function freeze()
- {
- with(mc_mainAlgorithm.startBtn)
- {
- _root.turn("toff",myQ,myA,myC);
- }
- var n = 0;
- while(n < buttonList.length)
- {
- buttonList[n].freeze();
- n++;
- }
- }
- function unfreeze()
- {
- with(mc_mainAlgorithm.startBtn)
- {
- _root.turn("rollout",myQ,myA,myC);
- }
- var n = 0;
- while(n < buttonList.length)
- {
- buttonList[n].unfreeze();
- n++;
- }
- }
- function doClose()
- {
- _level0.unfreezePreviousLevelAndUnStack(_root);
- _root.unloadMovie();
- }
- function convertToBinary(number)
- {
- var result = "";
- var i = 0;
- while(i < 32)
- {
- var lsb = number & 1;
- result = (!lsb ? "0" : "1") + result;
- number >>= 1;
- i++;
- }
- return result.substr(21,12);
- }
- function convertToDecimal(number)
- {
- var result = 0;
- nbChr = number.length;
- var i = 0;
- while(i < nbChr)
- {
- result += number.charAt(nbChr - 1 - i) != 1 ? 0 : Math.pow(2,i);
- i++;
- }
- return result;
- }
- function verify_Pretest_Question()
- {
- _root.Question = [];
- counter = 0;
- i = 1;
- while(i < 5)
- {
- if(_root.answer[i] != _level0.User_Choice_Pretest[i])
- {
- counter++;
- _root.Question[counter] = i;
- }
- i++;
- }
- counter2 = 4 - counter;
- while(counter < 5)
- {
- counter++;
- _root.Question[counter] = counter2 + counter;
- }
- }
- function Last_Question_Done()
- {
- _root.No_Essai = [];
- _root.No_Essai2 = [];
- _root.BtnClicked = new Array(5);
- _root.BtnClicked[1] = new Array(10);
- _root.BtnClicked[2] = new Array(10);
- _root.BtnClicked[3] = new Array(10);
- _root.BtnClicked[4] = new Array(10);
- _root.BtnClicked2 = new Array(5);
- _root.BtnClicked2[1] = new Array(10);
- _root.BtnClicked2[2] = new Array(10);
- _root.BtnClicked2[3] = new Array(10);
- _root.BtnClicked2[4] = new Array(10);
- counter = 0;
- _root.Which_Question = 1;
- i = 1;
- while(i < 5)
- {
- if(_level0.Algo_Question_Done[i] == 1)
- {
- if(_level0.Algo_Question_Done2[i] == 1)
- {
- counter++;
- _root.Which_Question = 1;
- }
- else
- {
- _root.Which_Question = 2;
- }
- }
- i++;
- }
- _root.testno = counter;
- i = 1;
- while(i < 5)
- {
- counter = 1;
- while(_level0.User_Choice_Algo[i][counter] != "" and _level0.User_Choice_Algo[i][counter] != null)
- {
- _root.BtnClicked[i][_level0.User_Choice_Algo[i][counter]] = 1;
- counter++;
- }
- _root.No_Essai[i] = counter - 1;
- i++;
- }
- i = 1;
- while(i < 5)
- {
- counter = 1;
- while(_level0.User_Choice_Algo2[i][counter] != "" and _level0.User_Choice_Algo2[i][counter] != null)
- {
- _root.BtnClicked2[i][_level0.User_Choice_Algo[i][counter]] = 1;
- counter++;
- }
- _root.No_Essai2[i] = counter - 1;
- i++;
- }
- }
-