home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / Leaderboard.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  1.7 KB  |  60 lines

  1. class Leaderboard extends MovieClip
  2. {
  3.    var onEnterFrame;
  4.    var sURL;
  5.    var btnBack;
  6.    var lvScores;
  7.    var mcCnt;
  8.    var mcScrollBar;
  9.    function Leaderboard()
  10.    {
  11.       super();
  12.       this.onEnterFrame = this.init;
  13.    }
  14.    function init(Void)
  15.    {
  16.       this.onEnterFrame = null;
  17.       this.sURL = Application.sBasePath + "GetScores.php";
  18.       this.loadHighScore();
  19.       this.btnBack = this._parent.btnBack;
  20.       this.btnBack.onRelease = mx.utils.Delegate.create(this,this.onReleaseBack);
  21.       trace("btnBack: " + this.btnBack);
  22.    }
  23.    function loadHighScore(Void)
  24.    {
  25.       this.lvScores = new LoadVars();
  26.       this.lvScores.onLoad = mx.utils.Delegate.create(this,this.onLoadList);
  27.       this.lvScores.load(this.sURL);
  28.    }
  29.    function onLoadList(bSuccess)
  30.    {
  31.       for(var _loc4_ in this.lvScores)
  32.       {
  33.          trace("key: " + _loc4_ + ", value: " + this.lvScores[_loc4_]);
  34.       }
  35.       ┬º┬ºpush(this.gotoAndStop("done"));
  36.       if(bSuccess)
  37.       {
  38.          var _loc2_ = 1;
  39.          while(_loc2_ < 21)
  40.          {
  41.             if(this.lvScores["name" + _loc2_] != undefined)
  42.             {
  43.                var _loc3_ = this.mcCnt.attachMovie("scoreRow","row" + _loc2_,_loc2_);
  44.                _loc3_.rank = _loc2_ + ".";
  45.                _loc3_.sName = this.lvScores["name" + _loc2_];
  46.                _loc3_.score = this.lvScores["score" + _loc2_];
  47.                _loc3_._y = 15 * (_loc2_ - 1);
  48.             }
  49.             _loc2_ = _loc2_ + 1;
  50.          }
  51.       }
  52.       this.mcScrollBar.attachScrollBar(this.mcCnt,1);
  53.    }
  54.    function onReleaseBack(Void)
  55.    {
  56.       trace("asd");
  57.       Interface.getInstance().onReleaseScoreBack();
  58.    }
  59. }
  60.