I am adding some tabs to the stage, and each tab loads its own swf file. I have an array tracking the tabs, but need to know when each swf is loaded which tab it belongs to. I'm not sure of the best way to do it.
Tabs are controlled by XML, so there can be any number of tabs -
for (var j = 0; j < _xmlTabs.length(); j++) {
arrTabs[j] = new Tab(j,_xmlTabs[j].attribute("icon"),_xmlTabs[j]);
addChildAt(arrTabs[j],0);
mRequest = new URLRequest(_xmlTabs[j].attribute("swf"));
mLoader = new Loader();
addChild(mLoader);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onTabComplete);
mLoader.load(mRequest);
}
Ok, so lets say there are 5 tabs being loaded, and each one loads its own swf, and "onTabComplete()" gets fired 5 times. Even though each tab is created in order, onTabComplete may not fire in order because the swfs will be different sizes. So how do I associate each tab with the onTabComplete function? Each instantiated Tab item does have a "position" property which can be retrieved.