1 person found this helpful
check for the duration property of your sound in its onLoad() method. that's when the duration reported will first be accurate. and, fix your pos() function to only reference your sound's duration when it's defined.
p.s. you don't need to apply the start() method to a streaming sound.
p.p.s. you could check if your sound has an id3 property. if it does, you can check the id3's TLEN property.
Hey, thanks for the response. Removing the start() method made it so the songs don't restart now when its fully loaded, thanks!
As for the other tips, the duration property only gets called in the durpos() function, which is called in the onLoad() method when a song is first selected. Are you saying that I should check for the duration before I call durpos()?
Also, I don't understand the suggestion to fix the pos() function because it never references duration, only position.
my mistake: make sure your sound's duration is defined before trying to use it.
I actually discovered a problem now that the start() method was taken out of the onLoad(). When a new song is selected, the song position does not get reset, so if the first song was at 13 seconds, the next song starts at the beginning but the clock says it starts at 13 seconds. Then if I pause and play, the song skips ahead to match the clock.