I'd like to play a random embedded MP3, but my efforts so far have been unsuccessful:
When debugging, the thread is suspended with "ReferenceError:Error #1065: Variable sfxLibrary3 is not defined"
private static var sfxLibrary1:Class;
private static var sfxLibrary2:Class;
private static var sfxLibrary3:Class;
// other sounds embedded here...
// ---- code removed for brevity ------ //
//create and play a random sound effect
var sfxNo:Number = Math.floor( Math.random( ) * 3 ) + 1;
var ClassReference:Class = getDefinitionByName("sfxLibrary"+String(sfxNo)) as Class;
var sfx:Sound = Sound(new ClassReference());
Can anyone see where I'm going wrong, or think of a better way of doing it?