home *** CD-ROM | disk | FTP | other *** search
- function startCompetition()
- {
- bg.gotoAndStop(3);
- bg.but_next._visible = false;
- bg.but_back.onRelease = backToStart;
- bg.but_reset.gotoAndStop(2);
- bg.but_start.onRelease = function()
- {
- bg.but_next._visible = true;
- board.loadCompetition();
- };
- getHighscore();
- }
- function startTraining()
- {
- bg.gotoAndStop(2);
- bg.but_next._visible = false;
- bg.but_back.onRelease = backToStart;
- bg.but_start.onRelease = function()
- {
- board.loadTraining();
- };
- bg.but_reset.gotoAndStop(2);
- bg.createEmptyMovieClip("container",1);
- bg.container._x = 412;
- bg.container._y = 212;
- loadLevelMenu(1);
- loadLevelMenu(2);
- loadLevelMenu(3);
- loadLevelMenu(4);
- }
- function backToStart()
- {
- bg.container.removeMovieClip();
- bg.gotoAndStop(1);
- bg.but_competition.onRelease = startCompetition;
- bg.but_training.onRelease = startTraining;
- }
- function loadLevelMenu(num)
- {
- var _loc4_ = new Level().getDifficultyLevels(num);
- var _loc2_ = 0;
- while(_loc2_ < _loc4_.length)
- {
- var _loc3_ = bg.container.attachMovie("menupoint" + num,"level" + _loc4_[_loc2_],bg.container.getNextHighestDepth());
- _loc3_._x = _loc2_ * 18;
- _loc3_._y = num * 20;
- _loc3_.txt.text = _loc4_[_loc2_];
- _loc3_.onRelease = function()
- {
- this._parent["level" + board.level].gotoAndStop(1);
- board.loadLevel(this.txt.text);
- this.gotoAndStop(2);
- };
- _loc2_ = _loc2_ + 1;
- }
- }
- function competitionPopUp(time)
- {
- if(time < worstscore)
- {
- var _loc2_ = this.attachMovie("competitionpopup","popup",this.getNextHighestDepth());
- _loc2_.gotoAndStop(1);
- _loc2_.thename.restrict = "A-Z a-z 0-9";
- _loc2_.submit_but.onRelease = function()
- {
- if(this._parent.thename.text != "")
- {
- this._parent._parent.saveHighscore(this._parent.thename.text,time);
- this._parent.removeMovieClip();
- bg.but_start.onRelease = function()
- {
- board.loadCompetition();
- };
- bg.but_back.onRelease = backToStart;
- }
- };
- _loc2_.cancel_but.onRelease = function()
- {
- this._parent.removeMovieClip();
- bg.but_start.onRelease = function()
- {
- board.loadCompetition();
- };
- bg.but_back.onRelease = backToStart;
- };
- }
- else
- {
- _loc2_ = this.attachMovie("competitionpopup","popup",this.getNextHighestDepth());
- _loc2_.gotoAndStop(2);
- _loc2_.cancel_but.onRelease = function()
- {
- this._parent.removeMovieClip();
- bg.but_start.onRelease = function()
- {
- board.loadCompetition();
- };
- bg.but_back.onRelease = backToStart;
- };
- }
- }
- function getHighscore()
- {
- var _loc1_ = "connection.php";
- var vars = new LoadVars();
- vars.command = "getHighscore";
- vars.onLoad = function(success)
- {
- if(success)
- {
- loadHighscore(vars);
- }
- else
- {
- trace("Error reading the php page");
- }
- };
- vars.sendAndLoad(_loc1_,vars,"POST");
- }
- function saveHighscore(name, time)
- {
- var _loc1_ = "connection.php";
- var vars = new LoadVars();
- vars.command = "saveHighscore";
- vars.name = name;
- vars.time = time;
- vars.onLoad = function(success)
- {
- if(success)
- {
- loadHighscore(vars);
- }
- else
- {
- trace("Error reading the php page");
- }
- };
- vars.sendAndLoad(_loc1_,vars,"POST");
- }
- function loadHighscore(vars)
- {
- bg.createEmptyMovieClip("container",1);
- bg.container._x = 400;
- bg.container._y = 215;
- timelines = new Array();
- var _loc1_ = 0;
- while(_loc1_ < vars.num)
- {
- var _loc3_ = vars["msg" + _loc1_].split(";");
- var _loc2_ = bg.container.attachMovie("highscore","highscore" + _loc1_,_loc1_);
- _loc2_.score.text = _loc1_ + 1;
- _loc2_.name.text = _loc3_[0];
- _loc2_.time.text = bg.timer.translateTimer(_loc3_[1]);
- _loc2_._y = _loc1_ * 10;
- if(_loc1_ == 9)
- {
- worstscore = _loc3_[1];
- }
- _loc1_ = _loc1_ + 1;
- }
- }
- function adjustDepth(car)
- {
- car.swapDepths(car._x + (car._y + 80) * 6 * 32);
- }
- stop();
- bg.stop();
- bg.but_competition.onRelease = startCompetition;
- bg.but_training.onRelease = startTraining;
- var worstscore = 10000000000;
-