Hi, im making a timer for someone ( www.flash-matic.com/timer.html ) and i need the Hours Mins and Secs to start out as 00 but that interpheres with the +/- 1 using the buttons. Also when you click reset all to 0 but the setinterval still takes 1 off hour and puts 59 to min.
here is the code:
hour = 00;
min = 00;
sec = 00;
clicked = false;
hads = 00;
hadm = 00;
hadh = 00;
st.onPress = function():Void{
if(clicked == false){
hads = sec;
hadm = min;
hadh = hour;
seco = setInterval(cd,1000);
zer = setInterval(zero,1);
zer2 = setInterval(zero2,1);
clicked = true;
}
}
sto.onPress = function():Void{
clearInterval(seco);
clearInterval(zer);
clearInterval(zer1);
sec = hads;
min = hadm;
hour = hadh;
clicked = false;
}
function cd (){
if(sec > 00){
sec -= 1;
}
}
function zero (){
if(sec == 00){
sec+=59;
min-=1;
}
}
function zero2 (){
if(min == 00){
min+=59;
hour-=1;
}
}
hup.onPress = function():Void{
hour+=1;
}
mup.onPress = function():Void{
min+=1;
}
hdo.onPress = function():Void{
if(hour >= 1){
hour-=1;
}
}
mdo.onPress = function():Void{
if(min >= 1){
min-=1;
}
}
re.onPress = function():Void {
clearInterval(seco);
clearInterval(zer);
clearInterval(zer1);
clicked = false;
hour = 0;
min = 0;
sec = 0;
}
here is the .fla if anyone needs it www.flash-matic.com/timer.fla