# Create MovieCLip

**URL:** <https://forum.kirupa.com/t/create-movieclip/185260>\
**Category:** flash\
**Created:** [April 12, 2006, 1:23am UTC](https://forum.kirupa.com/t/create-movieclip/185260 "2006-04-12T01:23:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hedstar](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hedstar](https://forum.kirupa.com/u/hedstar)\
**Post date:** [April 12, 2006, 1:23am UTC](https://forum.kirupa.com/t/create-movieclip/185260/1 "2006-04-12T01:23:54Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 12, 2006, 4:57am UTC](https://forum.kirupa.com/t/create-movieclip/185260/2 "2006-04-12T04:57:40Z")

</div>

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

```auto

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

```

---

<div class="post-metadata">

**Author:** ![hedstar](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hedstar](https://forum.kirupa.com/u/hedstar)\
**Post date:** [April 13, 2006, 2:17am UTC](https://forum.kirupa.com/t/create-movieclip/185260/3 "2006-04-13T02:17:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 3:27am UTC](https://forum.kirupa.com/t/create-movieclip/185260/4 "2006-04-13T03:27:23Z")

</div>

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}**

---

<div class="post-metadata">

**Author:** ![hedstar](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hedstar](https://forum.kirupa.com/u/hedstar)\
**Post date:** [April 14, 2006, 8:27am UTC](https://forum.kirupa.com/t/create-movieclip/185260/5 "2006-04-14T08:27:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 15, 2006, 12:43am UTC](https://forum.kirupa.com/t/create-movieclip/185260/6 "2006-04-15T00:43:19Z")

</div>

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
