Copy link to clipboard
Copied
Hi there I have created a Countdown clock in Flash CS6 the code will run but nothing seems to happen the clock does not start to count down can anyone please help: I have been at it for days and it is driving me insane
Code is below
this.onEnterFrame = function()
{
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var targetDate:Date = new Date(2016,7,25);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
var sec = Math.floor(timeLeft/1000);
var min = Math.floor(sec/60);
var hours = Math.floor(min/60);
var days = Math.floor(hours/24);
sec = String(sec % 60);
if(sec.length < 2){
sec = "0" + sec;
}
min = String(min % 60);
if(min.length < 2){
min = "0" + min;
}
hours = String(hours % 24);
if(hours.length < 2){
hours = "0" + hours;
}
days = String(days);
if(timeLeft > 0 ){
var counter:String = days + ":" + hours + ":" + min + ":" + sec;
time_txt.text = counter;
}else{
trace("TIME'S UP");
var newTime:String = "00:00:00:00";
time_txt.text = newTime;
delete (this.onEnterFrame);
}
}
Thanks Joel
Copy link to clipboard
Copied
While I cannot say if it is providing the correct information, it is providing a countdown. What I see when I start it is...
850:10:40:32
(which changes due to time changing)
Have you assigned the instance name to the textfield? Is the textfield's text color different than the background of the stage?
Copy link to clipboard
Copied
That is really strange all I can see are the placeholders and no countdor
Copy link to clipboard
Copied
Just a little update I took on the first line of code and it show me the remaining days but does not count the mm down I have to keep refreshing the page.
Copy link to clipboard
Copied
Here is a link to a file I made where I just copied in your code and created /named the textfield. Maybe you will be able to find some difference. If not try doing what I did with a new file.
Copy link to clipboard
Copied
Thanks Ned
Copy link to clipboard
Copied
Hi Ned
Once again thank you for your helpI am so sorry to bother you with this but when I ran the code it shows up as a blank screen but as soon as i take the top function out of the equation it works by showing me the time remaining but it is not counting down.
I am sure it is all my fault because I am new to this and thought this would be striaght forward it is a pity I can not skype you It is a mission now I have seen it done on youtube and it works right away but not for mes says trying to connect with Flash something about a font not being enabled.
Thanks again
Joel
Copy link to clipboard
Copied
Hi Murphy. You don´t have a file .fla .... countdown in AS3 (20 minutes) for one presentation. I ´am a principant in Flash. Thanks
Copy link to clipboard
Copied
Ah thank you so much Ned I just googled for this File and came here. Your Link worked for me on my Adobe flash CS6. But now I'm having trouble and confused about changing the time to at least I only want to have 2 minutes and 40 seconds wich or what or how do i exactually change it so i can get that? Please if you can let me know what to do thanks..
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more