zebbah
12-18-2002, 04:22 PM
hello!
i've tried using this code to tell what time is left of a dynamic loaded music clip. mclip = new Sound();
mclip.loadSound("music_clip.mp3", true);
_root.onEnterFrame = function() {
secondsTotal = Math.floor(mclip.duration / 1000);
minutesTotal = Math.floor(secondsTotal / 60);
secondsPlayed = Math.floor(mclip.position / 1000);
minutesPlayed = Math.floor(secondsPlayed / 60);
secondsLeft = (secondsTotal - secondsPlayed) % 60;
minutesLeft = minutesTotal - minutesPlayed;
display = minutesLeft + "." + secondsLeft;
};the problem is that i can't sync the minutes and seconds. this particular clip starts counting down from 4:49 but the minutes don't change when the seconds are 59, but 49. anyone know how i can fix this?
sorry if this is really stupid, but my math sux and so does my as... :P
thanx for any help! :)
i've tried using this code to tell what time is left of a dynamic loaded music clip. mclip = new Sound();
mclip.loadSound("music_clip.mp3", true);
_root.onEnterFrame = function() {
secondsTotal = Math.floor(mclip.duration / 1000);
minutesTotal = Math.floor(secondsTotal / 60);
secondsPlayed = Math.floor(mclip.position / 1000);
minutesPlayed = Math.floor(secondsPlayed / 60);
secondsLeft = (secondsTotal - secondsPlayed) % 60;
minutesLeft = minutesTotal - minutesPlayed;
display = minutesLeft + "." + secondsLeft;
};the problem is that i can't sync the minutes and seconds. this particular clip starts counting down from 4:49 but the minutes don't change when the seconds are 59, but 49. anyone know how i can fix this?
sorry if this is really stupid, but my math sux and so does my as... :P
thanx for any help! :)