Ich versuche, einen Countdown Countdown zu machen, ich glaube, ich habe alle Teile dort hält es mir immer diesen Fehler, wenn ich es testen .Flash Ein Fehler-1013: Das private Attribut kann nur für Klasseneigenschaft Definitionen verwendet werden
Irgendeine Idee was ist los?
package
{
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class MainTimer extends MovieClip {
private var currentMin:int;
private var currentSec:int;
private var oneSecondTimer:Timer = new Timer (1000,1);
public var timeHasStopped:Boolean=false;
public function MainTimer() {
// constructor code
trace("the main timer is here");
currentMin = 2;
currentSec = 5;
minBox.text = String(currentMin);
if(currentSec < 10)
{
secBox.text = "0" + String(currentSec);
}
else {
secBox.text = String(currentSec);
}
oneSecondTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
oneSecondTimer.start();
private function onTimerComplete(event:TimerEvent):void {
currentSec = currentSec -1;
if(currentSec <0)
{
currentSec =59;
currentMin -=1;
} //end if
if(currentMin < 0) {
currentMin =0;
currentSec =0;
timerHasStopped = true;
}
else
{
oneSecondTimer.start();
}
minBox.text =String(currentMin);
secBox.text =String(currentSec);
if(currentSec <10)
{
secBox.text = "0" + String(currentSec);
}
}
} // Ends Function
} // Ends Class
} // Ends Package