Song timer

i have an mp3 playing in my movie and i want a time to show in the media player. i want it to show like this: “current position time/song duration time”. it all works except that when the current position time gets to 31 (seconds) it adds one to the minute side. here’s my code:


onClipEvent(enterFrame){
 durMinutes = Math.round((mySound.duration/1000)/60);
 var durMinSeconds = durMinutes * 60;
 durSeconds = (Math.round(mySound.duration/1000)) - durMinSeconds;
 posMinutes = Math.round((mySound.position/1000)/60);
 var posMinSeconds = posMinutes * 60;
 posSeconds = Math.round(mySound.position/1000);
 if (posSeconds < 10){
  posSeconds = "0" + posSeconds;
 }
}

thanks in advance!

I just applied your code to something in my code and it does do what you say, jumps at 30 or 31 seconds. here’s what to change:
posMinutes = int((mySound.position/1000)/60);
im not crazy about the Math.round function since I’m not familiar with what it specifically does with ints and floats.

it works but now it needs to go back to 00 when it gets past 59. how do i go about that?

does anyone have any suggestions for that? i’m in a bad time crunch :frowning:

onClipEvent (enterFrame) {
	durMinutes = Math.floor((mySound.duration/1000)/60);
	var durMinSeconds = durMinutes*60;
	durSeconds = Math.floor(mySound.duration/1000)-durMinSeconds;
	posMinutes = Math.floor((mySound.position/1000)/60);
	var posMinSeconds = posMinutes*60;
	posSeconds = Math.floor(mySound.position/1000)-posMinutes;
	if (posSeconds<10) {
		posSeconds = "0"+posSeconds;
	}
}

??

scotty(-:

nope, that didn’t work :frowning: anything else?

Oops, my bad, i was thinking about this

        
onClipEvent (enterFrame) {
        durMinutes = Math.floor((mySound.duration/1000)/60);
        var durMinSeconds = durMinutes*60;
        durSeconds = Math.floor(mySound.duration/1000)-durMinSeconds;
        posMinutes = Math.floor((mySound.position/1000)/60);
        var posMinSeconds = posMinutes*60;
        posSeconds = Math.floor(mySound.position/1000)-posMinSeconds;
        if (posSeconds<10) {
                posSeconds = "0"+posSeconds;
        }
}

scotty(-: