home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / redbeard.swf / scripts / DefineSprite_427 / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-12  |  3.0 KB  |  113 lines

  1. function convertScoreToTime(scoreToBeConverted)
  2. {
  3.    var convertScore = - (scoreToBeConverted - 1000000);
  4.    var strScore = new String(convertScore);
  5.    if(convertScore > 99999)
  6.    {
  7.       var tmpTime = strScore.substring(0,2) + ":" + strScore.substring(2,4) + ":" + strScore.substring(4,6);
  8.    }
  9.    else if(convertScore > 9999)
  10.    {
  11.       var tmpTime = "0" + strScore.substring(0,1) + ":" + strScore.substring(1,3) + ":" + strScore.substring(3,5);
  12.    }
  13.    else if(convertScore > 999)
  14.    {
  15.       var tmpTime = "00:" + strScore.substring(0,2) + ":" + strScore.substring(2,5);
  16.    }
  17.    else if(convertScore > 99)
  18.    {
  19.       var tmpTime = "00:0" + strScore.substring(0,1) + ":" + strScore.substring(1,3);
  20.    }
  21.    else if(convertScore > 9)
  22.    {
  23.       var tmpTime = "00:00:" + strScore.substring(0,2);
  24.    }
  25.    else
  26.    {
  27.       var tmpTime = "00:00:0" + strScore.substring(0,1);
  28.    }
  29.    convertScore = tmpTime;
  30.    if(convertScore != "10:00:00")
  31.    {
  32.       return convertScore;
  33.    }
  34. }
  35. function getHighScores(period, target)
  36. {
  37.    target.records = 0;
  38.    if(saveScore)
  39.    {
  40.       target.score = localScore;
  41.       target.username = txtUsername;
  42.       target.notSentScore = localScore;
  43.       target.notSentUsername = txtUsername;
  44.    }
  45.    target.gamename = gamename;
  46.    target.low = 0;
  47.    target.high = 10;
  48.    target.formaction = "gethighscores";
  49.    target.dwm = period;
  50.    var preventCaching = getTimer() + random(100);
  51.    target.loadVariables("http://www.miniclip.com/Flash/proxy.php?preventCashing=" + preventCaching,"GET");
  52.    play();
  53. }
  54. function sendHighScore()
  55. {
  56.    if(txtUsername != "" && txtUsername != undefined)
  57.    {
  58.       getHighScores(2,mcHighScoreData);
  59.    }
  60. }
  61. this.username = "";
  62. this.score = 0;
  63. position_d = 0;
  64. position_w = 0;
  65. position_m = 0;
  66. mcHighScoreData.records = 0;
  67. dailyLoaded = false;
  68. weeklyLoaded = false;
  69. monthlyLoaded = false;
  70. dailyTabClicked = false;
  71. weeklyTabClicked = false;
  72. monthlyTabClicked = false;
  73. timeOutVal = 15000;
  74. completed = "false";
  75. localScore = int(eval(scoreLocation));
  76. if(scoreIsTime && localScore > 0)
  77. {
  78.    localScore = 1000000 - localScore;
  79. }
  80. this._x = int(this._x);
  81. this._y = int(this._y);
  82. if(gameName == undefined)
  83. {
  84.    trace("MINICLIP.COM HIGHSCORE COMPONENT WARNING");
  85.    trace("========================================");
  86.    trace("The \'gameName\' parameter has not been set. This parameter");
  87.    trace("needs to be set for the highscore component to function.");
  88.    error = true;
  89. }
  90. if(eval(scoreLocation) == undefined && saveScore)
  91. {
  92.    trace("MINICLIP.COM HIGHSCORE COMPONENT WARNING");
  93.    trace("========================================");
  94.    trace("The \'scoreLocation\' parameter does not contain any data.");
  95.    trace("This parameter needs to be pointing to the game score variable");
  96.    trace("set for the highscore component to function.");
  97.    error = true;
  98. }
  99. if(error == true)
  100. {
  101.    _parent.stop();
  102.    stop();
  103. }
  104. else if(saveScore && eval(scoreLocation) > 0)
  105. {
  106.    gotoAndPlay(2);
  107. }
  108. else
  109. {
  110.    getHighScores(2,mcHighScoreData);
  111.    gotoAndPlay(15);
  112. }
  113.