home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / SheepTeroids.swf / scripts / frame_44 / DoAction.as
Encoding:
Text File  |  2005-08-05  |  2.0 KB  |  85 lines

  1. score = totalscore;
  2. stop();
  3. showScores = function()
  4. {
  5.    var i = 10;
  6.    while(i > 0)
  7.    {
  8.       var n = scoreboard_lv["name" + (page + i)];
  9.       var s = scoreboard_lv["score" + (page + i)];
  10.       var l_mc = this["line" + i + "_mc"];
  11.       l_mc.rank_txt.text = page + i + ".";
  12.       l_mc.name_txt.text = !n.length ? "-" : n.toUpperCase();
  13.       l_mc.score_txt.text = s;
  14.       l_mc.rank_txt.textColor = l_mc.name_txt.textColor = l_mc.score_txt.textColor = !(playerName.length && n.toUpperCase() == playerName.toUpperCase()) ? 16777215 : 3407616;
  15.       l_mc._visible = true;
  16.       loading_mc._visible = false;
  17.       i--;
  18.    }
  19. };
  20. page = 0;
  21. maxScore = 100;
  22. scoreboard_lv = new LoadVars();
  23. if(score > 0 && playerName.length > 0)
  24. {
  25.    scoreboard_lv.score = score;
  26.    scoreboard_lv.name = playerName.toLowerCase();
  27. }
  28. scoreboard_lv.game = "sheepteroids";
  29. scoreboard_lv.sendAndLoad("http://www.kwikgames.com/cgi/games_score_sql.php",scoreboard_lv,"POST");
  30. scoreboard_lv.onLoad = function(success)
  31. {
  32.    if(success)
  33.    {
  34.       if(Boolean(scoreboard_lv.success))
  35.       {
  36.          next_btn._visible = true;
  37.          if(scoreboard_lv.maxScore.length > 0)
  38.          {
  39.             maxScore = Number(scoreboard_lv.maxScore);
  40.          }
  41.          showScores();
  42.       }
  43.       else
  44.       {
  45.          loading_mc.errorMsg = scoreboard_lv.errorMsg.toUpperCase();
  46.          loading_mc.gotoAndStop(2);
  47.       }
  48.    }
  49.    else
  50.    {
  51.       loading_mc.errorMsg = "COULD NOT ACCESS SCORES.";
  52.       loading_mc.gotoAndStop(2);
  53.    }
  54. };
  55. score = 0;
  56. next_btn._visible = last_btn._visible = false;
  57. last_btn.onPress = function()
  58. {
  59.    page -= 10;
  60.    if(page < 0)
  61.    {
  62.       page = 0;
  63.    }
  64.    if(page < 10)
  65.    {
  66.       last_btn._visible = false;
  67.    }
  68.    next_btn._visible = true;
  69.    showScores();
  70. };
  71. next_btn.onPress = function()
  72. {
  73.    page += 10;
  74.    if(page > maxScore)
  75.    {
  76.       page = maxScore;
  77.    }
  78.    if(page > maxScore - 20)
  79.    {
  80.       next_btn._visible = false;
  81.    }
  82.    last_btn._visible = true;
  83.    showScores();
  84. };
  85.