My timer counts down from 60 to zero. I want my movie to go to the next frame at zero count. How would I make a condition to go from frame 1-2? I need to find the right operator and values, but I get lost in the strings.
WHAT I'M TRYING
If (something is <> == true false);
gotoAndPlay(2);
stop();
//
var timer:Timer = new Timer(100, 300);
timer.addEventListener(TimerEvent.TIMER, countdown);
timer.start();
function countdown(event:TimerEvent) {
var totalSecondsLeft:Number = 60 - timer.currentCount;
myText.text = timeFormat(totalSecondsLeft);
}
function timeFormat(seconds:int):String {
// var minutes:int;
// var sMinutes:String;
var sSeconds:String;
if(seconds > 59) {
// minutes = Math.floor(seconds / 60);
// sMinutes = String(minutes);
sSeconds = String(seconds % 60);
} else {
// sMinutes = "";
sSeconds = String(seconds);
}
if(sSeconds.length == 1) {
sSeconds = "0" + sSeconds;
//###################################
//}
//if(bla bla bla?) {
//gotoAndPlay(2);
//###################################
}
return sSeconds;//return sMinutes + ":" + sSeconds;
}
I Tried This "Nothing"
stop();
var timer:Timer = new Timer(1000); // delay = time between ticks in milliseconds
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
timer.start();
function onTimer($evt:TimerEvent):void {
watch.hand.rotation = 30 + timer.currentCount;//tick 5
}
//function startAgain($evt:TimerEvent):void {
//timer.reset();
//timer.start();
//}
function onTimerComplete(e:TimerEvent):void
{
// remove listener
timer.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
// advance playhead to frame 2
gotoAndPlay(2);
}
I'm making several experiments like this to understand conditionals. I need to build objects that function similar to preloaders.