# Duplicating button

**URL:** <https://forum.kirupa.com/t/duplicating-button/7559>\
**Category:** Uncategorized\
**Created:** [November 2, 2002, 11:13pm UTC](https://forum.kirupa.com/t/duplicating-button/7559 "2002-11-02T23:13:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![toonamo](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@toonamo](https://forum.kirupa.com/u/toonamo)\
**Post date:** [November 2, 2002, 11:13pm UTC](https://forum.kirupa.com/t/duplicating-button/7559/1 "2002-11-02T23:13:56Z")

</div>

I’m trying to duplicate a button using action script

(for mc)  
onClipEvent (load)  
{  
maxDepth=1000;  
z=Math.round(Math.random()_maxDepth);  
fl=300;  
xcenter=175;  
ycenter=175;  
offx=(startx-xcenter);  
offy=(starty-ycenter);  
scale=fl/(fl+z);  
\_x=xcenter+offx_scale;  
\_y=ycenter+offy_scale;  
\_xscale=\_yscale=100_scale;  
}

(for root)  
nbClip=50;  
for (i=0;i\<nbClip;i++){  
duplicateMovieClip(ball,“ball”+i,i);  
mc=\_root[“ball”+i];  
mc.startx=Math.round(Math.random()\*300)-50;  
mc.starty=Math.round(Math.random()\*300)-50;  
}

So far the button is placed randomly but it isn’t being duplicated

what am i doing wrong ohh and yes this is one of the tutorials but isn’t explained.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 2, 2002, 11:18pm UTC](https://forum.kirupa.com/t/duplicating-button/7559/2 "2002-11-02T23:18:05Z")

</div>

you should be using a movie clip…not a button…MX allows mc’s to have properties of buttons…so yeah…u can do that…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 3, 2002, 12:03am UTC](https://forum.kirupa.com/t/duplicating-button/7559/3 "2002-11-03T00:03:39Z")

</div>

i am using a movie clip i guess i should have mentioned that should i try something else

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 3, 2002, 12:10am UTC](https://forum.kirupa.com/t/duplicating-button/7559/4 "2002-11-03T00:10:02Z")

</div>

HA HA HA HA HA

i figured it out. i had to type ball in the instance name as well. now the duplication works
