Question:
Actionscript 3.0 help!!!!!?
Matt W
2008-05-27 12:34:06 UTC
I have just scripted a countdown timer and the debugger finds nothing wrong but the first line. Flash CS3 using actionscript.
take a look and please tell me what might be the problem....

this.onEnterFrame = function () {

var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();

var targetDate:Date = new Date(currentYear,11,25);
var targetTime = targetDate.getTime();

var timeLeft = targetTime - currentTime;
var sec = Math.floor (timeLeft/1000);
var min = Math.floor (sec/60);
var hrs = Math.floor (min/60);
var days = Math.floor (hrs/24);
sec = String(sec % 60);
if (sec.length < 2) {
sec = "0" + sec;
}
min = String(min % 60);
if (min.length < 2) {
min = "0" + min;
}
hrs = String(hrs % 24);
if (hrs.length < 2) {
hrs = "0" + hrs;
}
days = String(days);

var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
time_txt.text = counter;
}
Three answers:
MexItalian
2008-05-27 12:42:07 UTC
what is this for? it depends on what you set it for in your flash project. That's pretty much the only way you can find out.
Thread7
2008-05-27 19:46:20 UTC
Try taking out the "this." on the first line.

This code kind of depends upon where it is in your project. The actionscript of a frame on the timeline? Or within an object? Try moving the code to a different place.
SodaBoda
2008-05-27 19:43:49 UTC
hmm im not sure when i try it i get no errors but nothing shows up.......im trying to think.........hmm maybe create a a movie clip and have the art to attach it to the stage


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...