Edits to post #25277168 by Etherblood
Edited at 2014-10-28 23:27:02
At 10/28/14 11:03 PM, Rovertarthead wrote: And it still speeds thro my numbers like nuts. Should I change the numbers to my own numbers? And is this were i put the action script?
Very good, the output is exactly what I expected it to be, try this script:
(replace the current one with this)
this.onEnterFrame = function()
{
var today:Date = new Date();
var currentTime = today.getTime();
var targetDate:Date = new Date(2014,9,31);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
if(timeLeft > 0 ){
var sec:int = timeLeft/1000;
var min:int = sec/60;
var hours:int = min/60;
var days:int = hours/24;
sec %= 60;
min %= 60;
hours %= 24;
var counter:String = days + ":";
if(hours < 10) counter += "0";
counter += hours + ":";
if(min < 10) counter += "0";
counter += min + ":";
if(sec < 10) counter += "0";
counter += sec;
time_txt.text = counter;
}else{
trace("TIME'S UP");
var newTime:String = "00:00:00:00";
time_txt.text = newTime;
delete (this.onEnterFrame);
}
}
I hope It'll work, I still does the same, but I changed the part where I'm not sure if as2 can do this.
(again, I never used as2 and the stuff i wrote above is untested, so there are no guarantees)
If it doesn't work we'll just continue to test it, post any new errors pls.
If it does I'll explain how to make a 2:30 timer from here.
At 10/28/14 11:03 PM, Rovertarthead wrote: And it still speeds thro my numbers like nuts. Should I change the numbers to my own numbers? And is this were i put the action script?
Very good, the output is exactly what I expected it to be, try this script:
(replace the current one with this)
this.onEnterFrame = function()
{
var today:Date = new Date();
var currentTime = today.getTime();
var targetDate:Date = new Date(2014,9,31);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
if(timeLeft > 0 ){
var sec:int = timeLeft/1000;
var min:int = sec/60;
var hours:int = min/60;
var days:int = hours/24;
sec %= 60;
min %= 60;
hours %= 24;
var counter:String = days + ":";
if(hours < 10) counter += "0";
counter += hours + ":";
if(min < 10) counter += "0";
counter += min + ":";
if(sec < 10) counter += "0";
counter += sec;
time_txt.text = counter;
}else{
trace("TIME'S UP");
var newTime:String = "00:00:00:00";
time_txt.text = newTime;
delete (this.onEnterFrame);
}
}
I hope It'll work, It still does the same, but I no longer use the same var for text and numbers.
(again, I never used as2 and the stuff i wrote above is untested, so there are no guarantees)
If it doesn't work we'll just continue to test it, post any new errors pls.
If it does I'll explain how to make a 2:30 timer from here.
Edited at 2014-10-28 23:19:20
At 10/28/14 11:03 PM, Rovertarthead wrote: And it still speeds thro my numbers like nuts. Should I change the numbers to my own numbers? And is this were i put the action script?
Very good, the output is exactly what I expected it to be, try this script:
(replace the current one with this)
this.onEnterFrame = function()
{
var today:Date = new Date();
var currentTime = today.getTime();
var targetDate:Date = new Date(2014,9,31);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
if(timeLeft > 0 ){
var sec:int = timeLeft/1000;
var min:int = sec/60;
var hours:int = min/60;
var days:int = hours/24;
sec %= 60;
min %= 60;
hours %= 24;
var counter:String = days + ":";
if(hours < 10) counter += "0";
counter += hours + ":";
if(min < 10) counter += "0";
counter += min + ":";
if(sec < 10) counter += "0";
counter += sec;
time_txt.text = counter;
}else{
trace("TIME'S UP");
var newTime:String = "00:00:00:00";
time_txt.text = newTime;
delete (this.onEnterFrame);
}
}
I hope It'll work, I still does the same, but I changed the part where I'm not sure if as2 can do this.
(again, I never used as2 and the stuff i wrote above is untested, so there are no guarantees)
If it doesn't work we'll just continue to test it.
If it does I'll explain how to make a 2:30 timer from here.
At 10/28/14 11:03 PM, Rovertarthead wrote: And it still speeds thro my numbers like nuts. Should I change the numbers to my own numbers? And is this were i put the action script?
Very good, the output is exactly what I expected it to be, try this script:
(replace the current one with this)
this.onEnterFrame = function()
{
var today:Date = new Date();
var currentTime = today.getTime();
var targetDate:Date = new Date(2014,9,31);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
if(timeLeft > 0 ){
var sec:int = timeLeft/1000;
var min:int = sec/60;
var hours:int = min/60;
var days:int = hours/24;
sec %= 60;
min %= 60;
hours %= 24;
var counter:String = days + ":";
if(hours < 10) counter += "0";
counter += hours + ":";
if(min < 10) counter += "0";
counter += min + ":";
if(sec < 10) counter += "0";
counter += sec;
time_txt.text = counter;
}else{
trace("TIME'S UP");
var newTime:String = "00:00:00:00";
time_txt.text = newTime;
delete (this.onEnterFrame);
}
}
I hope It'll work, I still does the same, but I changed the part where I'm not sure if as2 can do this.
(again, I never used as2 and the stuff i wrote above is untested, so there are no guarantees)
If it doesn't work we'll just continue to test it, post any new errors pls.
If it does I'll explain how to make a 2:30 timer from here.

