home *** CD-ROM | disk | FTP | other *** search
- function getAlphaNum(number)
- {
- toReturn = "";
- while(number > 0)
- {
- unite = number % baseAlphaNum;
- if(unite < 10)
- {
- toReturn = String.fromCharCode(unite + 48) + toReturn;
- }
- else if(unite < 36)
- {
- toReturn = String.fromCharCode(unite + 55) + toReturn;
- }
- else
- {
- toReturn = String.fromCharCode(unite + 61) + toReturn;
- }
- number = (number - unite) / baseAlphaNum;
- }
- return toReturn;
- }
- function getNumber(alphanum)
- {
- toReturn = 0;
- l = alphanum.length;
- i = 0;
- while(i < l)
- {
- unite = alphanum.charCodeAt(i);
- if(unite >= 48 && unite < 58)
- {
- toReturn = toReturn * baseAlphaNum + unite - 48;
- }
- else if(unite >= 65 && unite < 91)
- {
- toReturn = toReturn * baseAlphaNum + unite - 55;
- }
- else if(unite >= 97 && unite < 123)
- {
- toReturn = toReturn * baseAlphaNum + unite - 61;
- }
- i++;
- }
- return toReturn;
- }
- function playSurround(show)
- {
- if(show)
- {
- playback._visible = play_btn._visible;
- playback.gotoAndPlay(1);
- }
- else
- {
- playback._visible = false;
- }
- }
- function showButtons(vis)
- {
- pause_btn._visible = vis;
- play_btn._visible = vis;
- stop_btn._visible = vis;
- playback._visible = vis;
- }
- function clicStart()
- {
- if(!_root.timing)
- {
- menuder._visible = false;
- if(_root.voitureverte.gare && _root.voitureverte.replayPlay == false)
- {
- _root.timer_txt = "00:00:00:00";
- _root.voitureverte.init();
- _root.voitureverte.initReplayRec();
- }
- if(!_root.paused)
- {
- startFrame = frame;
- }
- _root.paused = false;
- _root.timing = true;
- aidetimestart = -1;
- }
- }
- function clicStop()
- {
- _root.timing = false;
- _root.paused = false;
- _root.timer_txt = "00:00:00:00";
- chocs_txt = "";
- art_txt = "";
- playSurround(true);
- menuder._visible = true;
- _root.voitureverte.init();
- _root.voitureverte.initReplayRec();
- aidetimestart = getTimer();
- }
- var vX = _root.voitureverte._x;
- var vY = _root.voitureverte._y;
- var vRot = _root.voitureverte._rotation;
- var xCorps = _root.voitureverte.bustebras._x;
- var yCorps = _root.voitureverte.bustebras._y;
- var xTete = _root.voitureverte.tete._x;
- var yTete = _root.voitureverte.tete._y;
- var frame = 0;
- var startFrame = 0;
- var baseAlphaNum = 62;
- var timing = false;
- chocs_txt = "";
- art_txt = "";
- aidetimestart = getTimer();
- _root.play_btn.onPress = function()
- {
- clicStart();
- };
- _root.stop_btn.onPress = function()
- {
- clicStop();
- };
- _root.pause_btn.onPress = function()
- {
- if(_root.timing)
- {
- _root.timing = false;
- _root.paused = true;
- playSurround(true);
- }
- };
- _root.onEnterFrame = function()
- {
- if(voitureverte.chocs > 0)
- {
- chocs_txttmp = "chocs : " + voitureverte.chocs;
- }
- else
- {
- chocs_txttmp = "";
- }
- if(voitureverte.noteArtistique > 0)
- {
- art_txttmp = "artistique : " + voitureverte.noteArtistique;
- }
- else
- {
- art_txttmp = "";
- }
- if(art_txttmp != art_txt)
- {
- art_txt = art_txttmp;
- }
- if(chocs_txttmp != chocs_txt)
- {
- chocs_txt = chocs_txttmp;
- }
- if(aidetimestart != -1 && getTimer() - aidetimestart > 2000)
- {
- _root.aide._visible = true;
- }
- else
- {
- _root.aide._visible = false;
- }
- if(timing)
- {
- playSurround(false);
- elapsedTime = (frame - startFrame) * 100 / 3;
- elapsedHours = Math.floor(elapsedTime / 3600000);
- remaining = elapsedTime - elapsedHours * 3600000;
- elapsedM = Math.floor(remaining / 60000);
- remaining -= elapsedM * 60000;
- elapsedS = Math.floor(remaining / 1000);
- remaining -= elapsedS * 1000;
- elapsedH = Math.floor(remaining / 10);
- if(elapsedHours < 10)
- {
- hours = "0" + elapsedHours.toString();
- }
- else
- {
- hours = elapsedHours.toString();
- }
- if(elapsedM < 10)
- {
- minutes = "0" + elapsedM.toString();
- }
- else
- {
- minutes = elapsedM.toString();
- }
- if(elapsedS < 10)
- {
- seconds = "0" + elapsedS.toString();
- }
- else
- {
- seconds = elapsedS.toString();
- }
- if(elapsedH < 10)
- {
- hundredths = "0" + elapsedH.toString();
- }
- else
- {
- hundredths = elapsedH.toString();
- }
- _root.timer_txt = hours + ":" + minutes + ":" + seconds + ":" + hundredths;
- frame++;
- }
- };
-