Okay, i'm very new to Actionscript 3
I would like my timer to direct whoever is playing my game to go the 'Game Over' screen on timer completion (00:00). At the moment I am getting an error saying "1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject."
Any ideas?
package {
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class SecondCounter extends MovieClip {
private var myTimer:Timer=new Timer(1000,0);
private var secs:Number=10;
private var mins:Number=0;
private var sec_t:String;
private var min_t:String;
var screen7:EndScreen;
public function SecondCounter() {
myTimer.addEventListener(TimerEvent.TIMER, timerHandler);
myTimer.start();
}
private function timerHandler(evt:TimerEvent):void {
if (secs==0) {
if (mins==0) {
addChild(EndScreen);
} else {
mins--;
secs=59;
}
} else {
secs--;
}
if(secs<10){
sec_t = "0"+String(secs)
} else {
sec_t = String(secs);
}
if(mins<10){
min_t = "0"+String(mins) +":"
} else {
min_t = String(mins)+":";
}
secondField.text = min_t + sec_t;
}
}
}