home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Corrida / drifting.swf / scripts / frame_3 / DoAction.as
Encoding:
Text File  |  2005-08-23  |  2.8 KB  |  87 lines

  1. serverPath = "http://www.driftgame.com.au/";
  2. if(id.length > 1)
  3. {
  4.    leagueGame = true;
  5.    trace("this is a league game");
  6. }
  7. else
  8. {
  9.    leagueGame = false;
  10.    trace("this is not a league game");
  11. }
  12. if(leagueGame)
  13. {
  14.    getLeagueInfo_lv = new LoadVars();
  15.    getLeagueInfo_lv.onLoad = function(success)
  16.    {
  17.       trace("got league information from server");
  18.       _root.leagueName = this.LeagueName;
  19.       _root.yourName = this.YourName;
  20.       _root.yourScore = Number(this.YourScore);
  21.       _root.player_array = new Array();
  22.       _root.player_array[0] = new Array();
  23.       _root.player_array[0].name = _root.yourName;
  24.       _root.player_array[0].score = _root.yourScore;
  25.       var _loc3_ = 1;
  26.       while(_loc3_ <= 15)
  27.       {
  28.          var _loc4_ = this["player" + _loc3_ + "Name"];
  29.          var _loc6_ = Number(this["player" + _loc3_ + "Score"]);
  30.          if(_loc4_ != undefined)
  31.          {
  32.             _root.player_array[_loc3_] = new Array();
  33.             _root.player_array[_loc3_].name = _loc4_;
  34.             _root.player_array[_loc3_].score = _loc6_;
  35.          }
  36.          _loc3_ = _loc3_ + 1;
  37.       }
  38.       _root.player_array.sortOn("score",18);
  39.       _loc3_ = 1;
  40.       while(_loc3_ <= 15)
  41.       {
  42.          var _loc5_ = _root.player_array[_loc3_ - 1].name;
  43.          if(_loc5_ != undefined)
  44.          {
  45.             _root["leagueTableNumber" + _loc3_] = _loc3_;
  46.             _root["leagueTableName" + _loc3_] = _root.player_array[_loc3_ - 1].name.toUpperCase();
  47.             _root["leagueTableScore" + _loc3_] = _root.player_array[_loc3_ - 1].score;
  48.          }
  49.          else
  50.          {
  51.             _root["leagueTableName" + _loc3_] = "";
  52.             _root["leagueTableNumber" + _loc3_] = "";
  53.             _root["leagueTableScore" + _loc3_] = "";
  54.          }
  55.          if(_root.player_array.length < 15)
  56.          {
  57.             leagueInterface_mc.add_player_button_mc.gotoAndStop(_root.player_array.length + 1);
  58.          }
  59.          else
  60.          {
  61.             leagueInterface_mc.add_player_button_mc.gotoAndStop(1);
  62.          }
  63.          if(_loc5_ == _root.yourName)
  64.          {
  65.             leagueInterface_mc["leagueTableName" + _loc3_ + "_txt"].textColor = "0xB3FF00";
  66.             leagueInterface_mc["leagueTableScore" + _loc3_ + "_txt"].textColor = "0xB3FF00";
  67.          }
  68.          else
  69.          {
  70.             leagueInterface_mc["leagueTableName" + _loc3_ + "_txt"].textColor = "0xFFFFFF";
  71.             leagueInterface_mc["leagueTableScore" + _loc3_ + "_txt"].textColor = "0xFFFFFF";
  72.          }
  73.          _loc3_ = _loc3_ + 1;
  74.       }
  75.       gotoAndStop("leagueStart");
  76.    };
  77.    getLeagueInfo_lv.LID = id;
  78.    var serverURL = _root.serverPath + "getLeagueInfo.cfm";
  79.    getLeagueInfo_lv.sendAndLoad(serverURL,getLeagueInfo_lv,"post");
  80. }
  81. else
  82. {
  83.    gotoAndStop("SPStart");
  84.    play();
  85. }
  86. stop();
  87.