So the solution to add time to the Timer
is to adjust the repeatCount
property. You would do that in your onPopIsClicked()
:
private function onPopIsClicked(pop:DisplayObject):void
{
nScore ++;
updateHighScore();
updateCurrentScore();
//Add Explosion Effect
popExplode = new mcPopExplode();
stage.addChild(popExplode);
popExplode.y = mPop.y;
popExplode.x = mPop.x;
elapsedTime += 5;
myTimer.repeatCount += 5; //add time to the timer
updateCountdownTimer();
}
So you will need to change how you display your countdown since we are increasing the repeatCount
property. What will happen is your myTimer.currentCount
may increase past the size of your count
variable. So in your onPopIsClicked()
add this line after you increment elapsedTime
:
elapsedTime += 5;
myTimer.repeatCount += 5;
count += 5//this line, increment the count total
You can also set a variable to increment by if you wanted:
var increaseBy:int = 5
Then you would use that with repeatCount, count, and elapsedTime (if you need that still):
elapsedTime += increaseBy;
myTimer.repeatCount += increaseBy;
count += increaseBy;
You really don't need elapsedTime
anymore unless you are using it for something else. Then you update your text, there is no need to add the elapsedTime
so it would look like:
countDownTextField.text = String(count- myTimer.currentCount);