AS2 Sound player / *I'm tired*

I done some debug.
I found that,

Script calculates the timebar position correct in the first song, if i select next song script continues to calculate from last timebar position.

So I have to reset the Tpercent variable for next and prev song
Here is my time calculate function. I’ll be really really glad if someone give me a clue!
Cause i really tired and i stuck.


function calculateTimeBar(k)
{
    
timeBar._xscale = 0;
timeBar.onEnterFrame = function() 
    {
  
    totaltime = Math.floor(this._parent.sndTrack.duration/1000);
    ongoingtime = Math.floor(this._parent.sndTrack.position/1000);
    
    Tpercent = Math.floor(ongoingtime / totaltime * 100);
    timeBar._xscale = Tpercent;
    

    }
    
}