Create MovieCLip

hi, please help me. How to duplicate movieclip from external *.txt file. For example, if the *.txt file contain string “2”, then the MovieClip will duplicate into “2” instance. thanx :pleased:

do you mean you want to load a text file into flash and then duplicate a movie clip as many times as the variable in the text file indicates?

if so in your text file put

&numberOfMCs=3&

and save it as vars.txt

then in flash use


//create a LoadVars
variables = new LoadVars();
//create the function that will execute when all the data is loaded in
variables.onLoad = function() {
	//loop the following actions as many times as the numberOfMCs var in the txt document dictates
	for (i=1; i<=variables.numberOfMCs; i++) {
		//duplicate the movie clip, giving it a new name and new depth
		duplicateMovieClip("nameOfOriginalMovieClip", "nameOfOriginalMovieClip"+i, i);
	}
};
//ok so now actually load the data
variables.load("vars.txt");

thanx mathew. But if i want to put each duplicated movie clip to different positions, how the action script can modificate?

thanx 4 all helps.

duplicateMovieClip(“nameOfOriginalMovieClip”, “nameOfOriginalMovieClip”+i, i, {_x:20, _y:20});

or whatever numbers you want to use.

you can even do it using i, or whatever u want

{_x:i*100, _y:20}

the script cant run,because duplicateMovieClip function only have 3 parameters. please help me. because i would like to make a flash movie with the concept is same with “Packet Tracer” from Cisco. anyone can help me.

sorry - research the MovieClip.duplicateMovieClip() function in the help file - thats the one i meant - you can pass initObject stuff like _x and _y with that one