The Fla file: Actionscript for buttons, uploading the XML file
Now open the actions panel and have a look at the scripts. At the top of the page is the preload script. Check the script attached to modelHolder_1 to learn more about tracing the loading event. Any way, we first create a general function with two arguments, which will be for the individual name buttons. We call the function ´showModel(modelName,fileName)´. The var modelName is the actual name of the model such as Kim for example. The var fileName is any XML file we want to upload.
//function to preload pics
function loadAll(firstPic,lastPic,picName){
for (j=firstPic;j<=lastPic;j++) {
duplicateMovieClip (_root.modelHolder_1,"pic_"+j, j);
setProperty ("pic_"+j, _alpha, (0));
loadMovie(picName+j+".swf","pic_"+j);
loadMovie(picName+j+".swf","modelHolder_1");
setProperty("modelHolder_1",_alpha, (0));
}
}
loadAll(1,6,"pic_");
loadMovie("agency.swf","modelHolder");
//general function to upload and get access to the xml files
//for the buttons
function showModel(modelName,fileName) {
//this is to empty the preloader textfield
counter="";
//variables for the name of the model and for the xml file
var modelName;
var fileName;
//uploading the xml, model is just an instance we use here
model = new XML();
model.onLoad = newModel;
//this facilitates accessing the xml tree, since white
//space is also considered childnode
model.ignoreWhite = true;
model.load(fileName);