Hi everybody,
I am trying to make an music player. It plays external mp3 files. It shows the duration of the sound object.
I click to STOP button and stop the music, then I click to PLAY button i can’t reset the time of that music, it continues from where it stopped before…
Stop:
on (release) {
dscSound.stop();
delete lastPosition;
flagCaliyor = false;
}
Play:
on (release) {
if (!lastPosition) {
dscSound.loadSound(String(inc)+".mp3", true);
dscSound.onID3 = function():Void {
songInfo.txtArtist.text = dscSound.id3.artist;
songInfo.txtTitle.text = dscSound.id3.songname;
};
dscSound.setVolume(50);
} else {
dscSound.start(lastPosition, 0);
}
flagCaliyor = true;
delete lastPosition;
}
to show the actual time:
function songTime():Void {
minutesTotal = Math.floor(_level0.dscSound.duration/60000);
secondsTotal = Math.floor(_level0.dscSound.duration/1000-minutesTotal*60);
seconds = Math.floor((_level0.dscSound.position/1000)%60);
minutes = Math.floor((_level0.dscSound.position/1000)/60);
hours = Math.floor((_level0.dscSound.position/1000)/120);
this._parent.songInfo.txtTotalTime.text = minutesTotal+":"+secondsTotal;
this._parent.songInfo.txtActualTime.text = minutes+":"+seconds;
trace(_level0.dscSound.position);
}
What can the problem be? Probably I’m missing sth…
Thanks for your helps…