Hi.
As I´m a decent flash-programmer g r a p h i c a l, i´m having problems with the coding-part.
I´m using this peace of code to start at timer.
_root.pausebutton._visible = 0;
//
function restartTimer() {
hours = "00";
minutes = "00";
seconds = "00";
milli = "00";
buttonPressTime = getTimer()/1000-pauseLength;
pause();
}
//
function pause() {
pauseTime = getTimer()/1000;
timing = false;
}
//
function unpause() {
unpauseTime = getTimer()/1000;
pauseLength = (unpauseTime-pauseTime)+pauseLength;
timing = true;
}
//
_root.onEnterFrame = function() {
totalTime = getTimer()/1000-pauseLength;
goTime = totalTime-buttonPressTime;
//
if (timing) {
hours = Math.floor(goTime/3600);
minutes = Math.floor((goTime/3600-hours)*60);
seconds = Math.floor(((goTime/3600-hours)*60-minutes)*60);
milli = Math.floor((gotime-(seconds+(minutes*60)+(hours*3600)))*100);
if (seconds<10) {
seconds = "0"+seconds;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (hours<10) {
hours = "0"+hours;
}
if (milli<10) {
milli = "0"+milli;
}
}
};
unpausebutton.onRelease=function() {
unpause();
pausebutton._visible = 1;
unpausebutton._visible = 0;
}
pausebutton.onRelease=function() {
pause();
unpausebutton._visible = 1;
pausebutton._visible = 0;
}
reset.onRelease= function() {
restartTimer();
pausebutton._visible = 0;
unpausebutton._visible = 1;
}
Now I´m having 2 problems since I want the timer to work on a multiple sets of frames. If i have the above piece of code on 2 frames, the 2 timers will follow eachothers. So the first question is:
How do I seperate the 2 timers from eachother?
The second problem is that when I move from frame 1 to frame 2, and then back to frame 1 (with a timer), I want the [red]STOP[/red] button to show if the timer is ticking, but now the START button shows evert time I enter the frame.
Thnxs.
/Petter
As I´m a decent flash-programmer g r a p h i c a l, i´m having problems with the coding-part.
I´m using this peace of code to start at timer.
_root.pausebutton._visible = 0;
//
function restartTimer() {
hours = "00";
minutes = "00";
seconds = "00";
milli = "00";
buttonPressTime = getTimer()/1000-pauseLength;
pause();
}
//
function pause() {
pauseTime = getTimer()/1000;
timing = false;
}
//
function unpause() {
unpauseTime = getTimer()/1000;
pauseLength = (unpauseTime-pauseTime)+pauseLength;
timing = true;
}
//
_root.onEnterFrame = function() {
totalTime = getTimer()/1000-pauseLength;
goTime = totalTime-buttonPressTime;
//
if (timing) {
hours = Math.floor(goTime/3600);
minutes = Math.floor((goTime/3600-hours)*60);
seconds = Math.floor(((goTime/3600-hours)*60-minutes)*60);
milli = Math.floor((gotime-(seconds+(minutes*60)+(hours*3600)))*100);
if (seconds<10) {
seconds = "0"+seconds;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (hours<10) {
hours = "0"+hours;
}
if (milli<10) {
milli = "0"+milli;
}
}
};
unpausebutton.onRelease=function() {
unpause();
pausebutton._visible = 1;
unpausebutton._visible = 0;
}
pausebutton.onRelease=function() {
pause();
unpausebutton._visible = 1;
pausebutton._visible = 0;
}
reset.onRelease= function() {
restartTimer();
pausebutton._visible = 0;
unpausebutton._visible = 1;
}
Now I´m having 2 problems since I want the timer to work on a multiple sets of frames. If i have the above piece of code on 2 frames, the 2 timers will follow eachothers. So the first question is:
How do I seperate the 2 timers from eachother?
The second problem is that when I move from frame 1 to frame 2, and then back to frame 1 (with a timer), I want the [red]STOP[/red] button to show if the timer is ticking, but now the START button shows evert time I enter the frame.
Thnxs.
/Petter