Timer errors on .flv playback

Hello Kirupa world,

I found a code on the forums for the time elapsed on .flv playback. I am trying to build a custom player that plays multiple .flv’s. The source code I found does work on the first video selected but with every video thereafter, the timer flickers. I’m trying to figure out a way to get the timer to reset when a new video is selected. I know it’s an easy fix and would really appreciate any help from you guys.

This is what I have so far.

var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(my_ns:NetStream) {
    var ns_seconds:Number = my_ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60);
        if (seconds<10) {
        seconds = "0"+seconds;
        }
    time_txt.text = minutes+":"+seconds;
    }
};