PDA

View Full Version : How to play a variable linked to soundfile



toth
October 26th, 2005, 01:35 PM
Hi,

I have a variable named 'SoundFile' that's linked to a DB dir /audio/sound.mp3. How do I play this sound file with the variable?
I'm not that good at actionscripting :sigh:

gr, toth

Balala
October 26th, 2005, 01:52 PM
var my_sound:Sound = new Sound();
my_sound.loadSound(SoundFile, true);

This will load a streaming sound, if you wont, do somenthing like that:


var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean):Void {
if (success) {
my_sound.start();
}
};
my_sound.loadSound(SoundFile, false);

Will only play the sound after fully loaded