[quoted text, click to view] TomEnokR wrote:
> I want to create a simple timer that includes:
>
> 1. Start button that starts the timer.
> 2. Stop button that stops the timer.
> 3. Reset button that resets the timer.
> 4. text or combobox that associates the time with a task.
>
> Mostly I just need the 'timer' functionality. Anyone have any code that can
> help?
Make dyn. text field with vars name "timeDisplay"
Than make Start, Stop , Reset Buttons.
Place all in movie clip and to that movie clip attach the following action :
// on the movieclip
onClipEvent (load) {
function start() {
d = new Date();
t0 = getTimer();
method = run;
}
function run() {
d.setTime(getTimer()-t0);
var h = d.getUTCHours();
if (h<10) {
H = "0"+h;
}
var m = d.getUTCMinutes();
if (m<10) {
m = "0"+m;
}
var s = d.getUTCSeconds();
if (s<10) {
s = "0"+s;
}
var ms = d.getUTCMilliSeconds();
if (ms<100) {
ms = "0"+ms;
}
if (ms<10) {
ms = "0"+ms;
}
timeDisplay = h+" : "+m+" : "+s+" : "+ms;
}
}
onClipEvent (enterFrame) {
method();
}
Than back to buttons and , to Start button ad :
on (press) {
if (!running) {
method = start;
running = true;
}
}
to Stop :
on (press) {
method = null;
running = false;
}
to Reset
on (press) {
method = null;
timeDisplay = rapTime="";
running = false;
}
Pretty much it.
http://www.flashfugitive.com/ang-zhang/stopWatch/ d/l
http://www.flashfugitive.com/ang-zhang/stopWatch/stopwatch.zip --
Regards
urami_*
<hol>
http://flashfugitive.com/ </hol>
By The way:
If you try to mail me , DO NOT *laugh*