# I really need HELP with duplicating movies

**URL:** <https://forum.kirupa.com/t/i-really-need-help-with-duplicating-movies/185503>\
**Category:** flash\
**Created:** [April 13, 2006, 7:10pm UTC](https://forum.kirupa.com/t/i-really-need-help-with-duplicating-movies/185503 "2006-04-13T19:10:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikini](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikini/32/225_2.png) [@Nikini](https://forum.kirupa.com/u/Nikini)\
**Post date:** [April 13, 2006, 7:10pm UTC](https://forum.kirupa.com/t/i-really-need-help-with-duplicating-movies/185503/1 "2006-04-13T19:10:11Z")

</div>

I tried to duplicate a movie in runtime (used the mc.duplicateMovieClip function). It duplicates just fine… but the function it had in its first frame doesn’t work for the duplication…  
To say it in another way…  
**Example:** I created mc and in its first frame i wrote the function

```auto

function write_some(s) {
trace(s);
}

```

And I wrote this for a button in the \_root on the on release part

```auto

mc.duplicateMovieClip("mc1",_root.getNextHighestDepth());
_root["mc1"].write_some("test");

```

.  
The movieclip duplicates just fine but no output!! How to make it work??

---

<div class="post-metadata">

**Author:** ![creatify](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@creatify](https://forum.kirupa.com/u/creatify)\
**Post date:** [April 13, 2006, 11:08pm UTC](https://forum.kirupa.com/t/i-really-need-help-with-duplicating-movies/185503/2 "2006-04-13T23:08:48Z")

</div>

I have to say, this has me scratching my head - not sure why it doesn’t work.

but, you can get the same results by doing this way, if you can do it this way:

```auto

// duplicate your movie - but store it in a variable

var dup = mc.duplicateMovieClip("mc1", _root.getNextHighestDepth());

// you can dynamically set this function on the fly - even though it exists within the clip already - this probably overwrites that one

dup.write_some = function(s) {
	trace("this is dup: "+s)
}

// then you can call the code on your duplicate clip
dup.write_some("this works");

```

---

<div class="post-metadata">

**Author:** ![Nikini](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikini/32/225_2.png) [@Nikini](https://forum.kirupa.com/u/Nikini)\
**Post date:** [April 14, 2006, 12:05am UTC](https://forum.kirupa.com/t/i-really-need-help-with-duplicating-movies/185503/3 "2006-04-14T00:05:20Z")

</div>

Never mind… i figured it out…😃 thnks anyway… your method was ok but think that i have a function that has 65 lines of code… to adapt it to the dup.wr… it’s not worth it… but i have realized that flash cannot run functions of a duplicated movie in the same on(release) block…😃 Weird… right??

---

<div class="post-metadata">

**Author:** ![creatify](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@creatify](https://forum.kirupa.com/u/creatify)\
**Post date:** [April 14, 2006, 12:21am UTC](https://forum.kirupa.com/t/i-really-need-help-with-duplicating-movies/185503/4 "2006-04-14T00:21:03Z")

</div>

interesting - thanks for that info!
