Hi,
I made a simple progressbar when you play a mp3 file.
var my_sound:Sound = new Sound();
This is my play button:
on(release)
{
_root.my_sound.stop();
_root.my_sound.loadSound("mysound.mp3", true);
gotoAndStop("on");
}
When I push play it jumps to a frame called “on”, on that frame I have this code and a stop button:
function soundStatus(){
duration = _root.my_sound.duration;
position = _root.my_sound.position;
_root.playhead._xscale = position / duration * 132 + 0.1;
}
my_interval = setInterval(soundStatus, 100, my_sound);
_root.my_sound.onSoundComplete = function() {
gotoAndPlay("off");
}
This is the Stop button
on(release)
{
_root.my_sound.stop();
gotoAndPlay("off");
}
But if I push the stop button in the middle of the song the progressbar doesn’t reset, and if I Play the song again, the song it self starts from the beginning but the progressbar continues where I stopped it the last time.
How can I reset the progressbar when I hit the stop button?
I tried with position = 0; and stuff like that but nothing works.