# duplicateMovieClip help

**URL:** <https://forum.kirupa.com/t/duplicatemovieclip-help/222116>\
**Category:** Uncategorized\
**Created:** [April 11, 2007, 12:03am UTC](https://forum.kirupa.com/t/duplicatemovieclip-help/222116 "2007-04-11T00:03:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsg4](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@wsg4](https://forum.kirupa.com/u/wsg4)\
**Post date:** [April 11, 2007, 12:03am UTC](https://forum.kirupa.com/t/duplicatemovieclip-help/222116/1 "2007-04-11T00:03:23Z")

</div>

Greetings my fellow Flash users;

I am having difficulty scripting for a videogame I am creating.

I would like to utilize the duplicateMovieClip function, however I have not seen any tutorials that explain how to duplicate mc’s WITHOUT a button. I wish to use a timing function so that the movie clips are randomly created at a certain time.

Here is the code I am currently using on my first frame:

function duplicateMC (){  
i = Math.random(1)\*100;  
i = Math.floor (1);  
duplicateMovieClip(\_root.my\_mc, “my\_mc”+i, i);  
setProperty(“my\_mc”+i, \_x, Math.random(1)\*200);  
setProperty(“my\_mc”+1,\_y, Math.random(1)\*200);  
}

And the code on my\_mc:

onClipEvent(enterFrame){  
time = getTimer();  
if(time \>=1000){  
duplicateMC();  
}

This code has not worked in duplicating my\_mc (based on time). For testing purposes I have created a button to see if I could duplicate my\_mc from the button and it has worked.

Any suggestions? I am working with Flash 8 and MX 2004.
