I've got a code that reads a sound in the language chosen by the user. For now, my code is :
if (english == true){
helloSound = new hello_english();
}
if (french == true){
helloSound = new hello_french();
}
As I've got even more words and even more languages to add, I want to simplify my code.
What I'd like to do :
When app launch, the user choose the language.
english.addEventListener(MouseEvent.CLICK, goEnglish, false, 0, true);
french.addEventListener(MouseEvent.CLICK, goFrench, false, 0, true);
function goEnglish(event:MouseEvent):void {
var audioChosen = "english";
}
function goFrench(event:MouseEvent):void {
var audioChosen = "french";
}
And then is it possible to do something like?
helloSound = new hello_(audioChosen)();
So, in this example, the sound that will be play, would be : hello_english