當我引用它來獲取西班牙語或英語XML數據時,我需要將4個字母添加到變量名中。我正在嘗試在不寫if語句的情況下重用我的函數。將字母附加到變量名上
像這樣:
//two options for
var spa_my_videos:XMLList;
var eng_my_videos:XMLList;
//APPEND OPTIONS
var spanishLang:String = "spa_";
var englishLang:String = "eng_";
//CALL FUNCTION AND ADD APPEND OPTION
makePlayer (englishLang);
function makePlayer (lang:String):void {
my_player = new FLVPlayback();
my_player.seekBar = SB;
my_player.playPauseButton = PPB;
my_player.volumeBar = VB;
my_player.x = video_x;
my_player.y = video_y;
my_player.width = 1023;
my_player.height = 630;
main_container.addChild (my_player);
//THIS IS WERE DEPENDING ON THE VALUE OF LANG I NEED TO USE THE spa_ or eng_ XML data
my_player.source = root_path + lang + my_videos[0][email protected];
}