PDA

View Full Version : difficulty with .loadSound


jimjams
10-10-2006, 01:03 AM
I'm trying to make a bit of flash to play streaming sound. When a "pause" button is pressed it sets pauseposition to the number of milliseconds into the file and stops the music. When play is pressed again it calls jukebox, which I hoped would start from where the music finnished. However, it just starts the mp3 from the begining again.

function jukebox () {
stopAllSounds ();
trace ("jukebox called")
_root.podCast = new Sound();
_root.podCast.loadSound("podcast"+_global.tracknumber+".mp3", true);
var pausepostionseconds:Number;
_global.pausepositionseconds = Math.round (pauseposition / 1000);
_root.podCast.start (pausepositionseconds);
}

even if I just use

_root.podCast.start (30);

the mp3 always starts from the begining. However else where in the same piece of flash


_root.podCast.start (variable);

works just fine.

Am I going mad?

Thanks, Jimmy.

sumeet
10-10-2006, 07:25 AM
Just try this code
function jukebox() {
_root.podCast = new Sound();
_root.podCast.onLoad = function(success) {

if (success) {
var pausepostionseconds:Number;

//_global.pausepositionseconds = Math.round(pauseposition/1000);
_root.podCast.start(30);
}
};
_root.podCast.loadSound("podcast.mp3", false);
}
jukebox();

jimjams
10-10-2006, 11:54 AM
Thanks, that works. As always in flash, I don't know why what I was doing doesn't work. Did I have the loadSound and the start in the wronr order? Cheers,
Jimmy