End Movie Timer

I’m trying to make a timer for a movie, so far i have AS like this on a MC that is playing…


onClipEvent(enterFrame) {

     timer = getTimer()
     rtime = Math.round(timer/1000)
     _root.frameText.text = "Current Frame: " +  _currentframe;
     _root.timebox.text = "Seconds elapsed: " + rtime;



What i want to know… How can i get the timer to stop counting when this mc gets to the last frame ? and restart when if it’s played over again.