I can’t seem to access the sound duration value in my code, I am not sure what I am doing wrong.
var directory:String = "Voices/";
var noOfSongs:Number = 100;
var aSongs:Array = [];
var currIndex:Number = 0;
for (var i = 1; i<=noOfSongs; i++) {
aSongs.push("v"+i+".mp3");
}
VSound = new Sound(Voice1_mc);
function playSound(songIndex:Number):Void {
VSound.loadSound(directory+aSongs[songIndex], true);
VSound.setVolume(VSound.getVolume()+50);
trace(VSound.duration);
VSound.start(0, 0);
}
VSound.onSoundComplete = function() {
currIndex++;
if (currIndex == aSongs.length) {
currIndex = 0;
}
playSound(currIndex);
};
playSound(currIndex);