home *** CD-ROM | disk | FTP | other *** search
- JetStreamTimer = function(mc)
- {
- this.mc = mc;
- this.mc.obj = this;
- this.mc.initAllDigits = function(mc)
- {
- this.obj.initAllDigits(mc);
- };
- GAME.addListener(this);
- };
- t = JetStreamTimer.prototype;
- t.mc = false;
- t.numberFlipper = false;
- t.timeRemaining = 0;
- t.timeElapsed = 0;
- t.totalTime = 0;
- t.lastTime = 0;
- t.initAllDigits = function(mc)
- {
- this.numberFlipper = new NumberFlipper(mc,2);
- };
- t.start = function(time)
- {
- this.totalTime = time;
- this.timeRemaining = this.totalTime;
- this.timeElapsed = 0;
- this.lastTime = getTimer() / 1000;
- this.mc.onEnterFrame = function()
- {
- this.obj.timerLoop();
- };
- this.mc.gotoAndPlay("show");
- };
- t.stop = function()
- {
- this.totalTime = 0;
- this.timeRemaining = 0;
- this.timeElapsed = 0;
- this.lastTime = 0;
- this.draw();
- this.mc.gotoAndPlay("hide");
- delete this.mc.onEnterFrame;
- };
- t.reset = function()
- {
- };
- t.timerLoop = function()
- {
- var _loc2_ = getTimer() / 1000;
- var _loc3_ = _loc2_ - this.lastTime;
- this.lastTime = _loc2_;
- this.timeElapsed += _loc3_;
- this.timeRemaining = this.totalTime - this.timeElapsed;
- this.timePer = this.timeRemaining / this.totalTime;
- if(this.timeRemaining < 0)
- {
- GAME.turnOffJetStream();
- }
- this.draw();
- };
- t.draw = function()
- {
- this.numberFlipper.showNum(Math.ceil(this.timeRemaining));
- this.mc.time_out = this.timeRemaining;
- };
- t.onLevelStart = function()
- {
- };
- t.onLevelComplete = function()
- {
- };
- t.onLevelIncomplete = function()
- {
- };
-