Ok, here's what I came up with.
Since Flash 5 doesn't support dynamic event handlers, or dynamic creation of clips, you will first need to create an empty movieclip symbol to house an onClipEvent(enterFrame).
Anywho, here's basic steps....
//timer not run yet notification (printed to textbox)
showTimer = "Timer Not Started Yet";
//have timer stopped from the beginning
_global.runTimer = false;
//function to start running the timer script
function startTimer() {
_global.timerStartTime = getTimer();
_global.runTimer = true;
}
//function to stop running the timer script
function stopTimer() {
_global.runTimer = false;
}
- //timer not run yet notification (printed to textbox)
- showTimer = "Timer Not Started Yet";
- //have timer stopped from the beginning
- _global.runTimer = false;
- //function to start running the timer script
- function startTimer() {
- _global.timerStartTime = getTimer();
- _global.runTimer = true;
- }
- //function to stop running the timer script
- function stopTimer() {
- _global.runTimer = false;
- }
Those actions will go in frame 1 of your movie.
Then, on an empty movieclip symbol on the stage you will apply these actions
onClipEvent (enterFrame) {
//if the runTimer variable is true
if (_global.runTimer) {
//run the timer!
timer = Math.floor((getTimer()-_global.timerStartTime)/1000);
//print value to textbox
_parent.showTimer = timer+" second(s) passed";
}
}
- onClipEvent (enterFrame) {
- //if the runTimer variable is true
- if (_global.runTimer) {
- //run the timer!
- timer = Math.floor((getTimer()-_global.timerStartTime)/1000);
- //print value to textbox
- _parent.showTimer = timer+" second(s) passed";
- }
- }
Now in my example there are 2 buttons. One of them contains this action
on (release) {
startTimer();
}
- on (release) {
- startTimer();
- }
and the other contains
on (release) {
stopTimer();
}
- on (release) {
- stopTimer();
- }
And last put not least, the last step in my example was to create a dynamic textbox on the stage that has the var name "showTimer".
Note: This is a Flash 5 recreation of the example I showed you in your other thread. It may not be exactly what you need, but the basic idea is still there, it sounds like all you will really need is to adjust when the startTimer() and stopTimer() functions are called (as well as not having it print to a textbox if you don't need that)