First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Joachim Schnier | Website: http://www.cancerinform.net/

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);

» Level Intermediate

Added: 2002-07-05
Rating: 7.92 Votes: 146
(10 being the highest)
» Author
The author is a scientist working in cancer research.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.