home *** CD-ROM | disk | FTP | other *** search
- ScoreDisplay = function(mc)
- {
- this.mc = mc;
- this.mc.obj = this;
- GAME.addListener(this);
- };
- t = ScoreDisplay.prototype;
- t.mc = false;
- t.curNum = 0;
- t.displayNum = 0;
- t.destNum = 0;
- t.lastSoundNum = 0;
- t.showScore = function(score)
- {
- Audio.play("geo_counter_1_snd");
- this.lastSoundNum = this.curNum;
- this.destNum = score;
- this.startLoop();
- };
- t.startLoop = function()
- {
- this.mc.onEnterFrame = function()
- {
- this.obj.loop();
- };
- };
- t.stopLoop = function()
- {
- delete this.mc.onEnterFrame;
- };
- t.loop = function()
- {
- this.curNum += (this.destNum - this.curNum) * 0.2;
- this.displayNum = "" + Math.round(this.curNum);
- if(this.displayNum == this.destNum)
- {
- this.stopLoop();
- this.curNum = this.destNum;
- }
- if(this.curNum > 1000)
- {
- var _loc2_ = this.displayNum.length;
- this.displayNum = this.displayNum.substring(0,_loc2_ - 3) + "," + this.displayNum.substring(_loc2_ - 3,_loc2_);
- }
- this.mc.text = this.displayNum;
- if(this.curNum - this.lastSoundNum > 50)
- {
- this.lastSoundNum = this.curNum;
- Audio.play("geo_counter_1_snd");
- }
- };
-