This one was quite a tough one, but I managed to figure it out after I saw this sentence at the ActionScript dictionary: “If the sound is looped, the position will be reset to 0 at the beginning of each loop”. So I figured it didn’t for streaming non looping sounds, and indeed. Here you are
Thanks a lot.
I tried it and it worked when the sound was stopped when playing less than 1 minute. However, I understand the principle (I think…) and made some small changes to the code.
instead of 1 variable ‘alreadyplayed’ I now have 2 variables: ‘secondsPlayed’ and ‘minutesPlayed’.
However I’m still very confused about this. Why wouldn’t the sound.position be reset to 0 when there it’s stopped and the play -butoon has a loadSound action on it.
It makes no sense to me at all, I’m afraid… :q:
Let’s say I have 1.mp3 with duration = 0:20
If I stop it after 5 secs and then press play again, the sound starts over and the timer starts at 0:00 again but now stops at 0:15, so 5 secs before the sound is actually finished.
There also is a problem when the changeTrack function is called when the sound finishes or when you press the ‘previous’ or ‘next’ button:
trace(mySound.position/1000);
which is called onEnterFrame just shows the length of the next sound and not the actual position.
Can anybody please help me out on this 'cause it’s really annoying me.
Isn’t there a way to somehow reset the sound.position manually??
This is getting on my nerves, it never works the way it’s supposed to. I suggest we go another way: use setInterval to update the timer. Way easier to control, and you can practically do anything with it, plus, easily resetting it. You know how to use setInterval or do you need an example ?