flash actionscript:
hello,
i'm trying to write a timer that counts down from 10 minutes then start over.
i just want it to decrement the minutes, seconds and milliseconds. i have the
milliseconds "sort of" working and the seconds can countdown, but i can't
control where the seconds and minutes start. i want them to start at 10 for
minutes and and the seconds at 00 then go to 59. right now, all i can get the
seconds and minutes to get those from the computer.
my solution for my timer is: set minutes to 10 and then when getMinutes()
changes, decrement by 1, the same with seconds. i just dont know the proper
syntax to get my code to work. the code for the onEnterFrame part is really
messed up right now cause i don't know where to go....
thanks!
--kevin
_root.onLoad = function() {
loadItUp();
function loadItUp(minutes, seconds) {
test = new Date();
sec1 = test.getSeconds();
if (sec1<59) {
while (sec1<59 && sec1 != 0) {
sec1++;
//trace(sec1);
}
}
if (sec1 == 59) {
//trace("sec1 = 59");
}
if (sec1 == 0) {
//trace("sec1 = 0");
}
min1 = test.getMinutes();
if (min1 != 10) {
if (min1>10) {
while (min1>10) {
min1--;
//trace(min1);
}
}
if (min1<10) {
min1++;
//trace(min1);
}
}
//trace(min1);
//trace(sec1);
return workItOut(min1, sec1);
}
};
///////////////////////////////
_root.onEnterFrame = function() {
workItOut();
function workItOut() {
bloopy = new Date();
millisecsier = 999-(Math.floor(bloopy.getMilliseconds()));
if (millisecsier<100) {
myTextBox.text = ":0"+millisecsier;
} else if (millisecsier<10) {
myTextBox.text = ":00"+millisecsier;
} else if (millisecsier == 0) {
myTextBox.text = ":000"+millisecsier;
} else {
myTextBox.text = ":"+millisecsier;
}
///////////////////////////////
gloopy = bloopy.getSeconds();
//trace("GLOOPY!");
myTextBox2.text = gloopy;
myTextBox2.onChanged = function() {
myTextBox2.text = ;
//gloopier = sec1--;
trace(gloopier);
};
//myTextBox2.text = gloopier;
///////////////////////////////
sloopy = bloopy.getMinutes();
//trace("SLOOPY!");
if (sec1 == 00) {
min1--;
trace(min1);
myTextBox3.text = min1;
}
//sloopier = min1;
//myTextBox3.text = sloopy;
}
};
///////////////////////////////