# How can i use duplicated clips as buttons?

**URL:** <https://forum.kirupa.com/t/how-can-i-use-duplicated-clips-as-buttons/170127>\
**Category:** flash\
**Created:** [November 23, 2005, 1:02am UTC](https://forum.kirupa.com/t/how-can-i-use-duplicated-clips-as-buttons/170127 "2005-11-23T01:02:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drey](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/drey/32/1948_2.png) [@drey](https://forum.kirupa.com/u/drey)\
**Post date:** [November 23, 2005, 1:02am UTC](https://forum.kirupa.com/t/how-can-i-use-duplicated-clips-as-buttons/170127/1 "2005-11-23T01:02:20Z")

</div>

Hej!  
I’m annoying, I know :hugegrin: second question in one day ☹ I wouldn’t do it if my time wouldn’t be running too fast…

The point is:  
I have a clip, duplicated to realize the titles of a menu. How can i use these duplicated clips to load the submenus? (The submenu is another clip, duplicated using the numbers contained in the same array)

My script (or, i’d better say, Stringy’s!) is:

/\*  
array: its lenght gives me the number of titles, each number inside the quantity of submenu for each title  
\*/  
n = [3 , 2 , 5];

```
for (i=0; i&lt;n.length; i++) {
    goccia = "dropMenu"+i;
    var l = _root.cont.dropMenu.duplicateMovieClip(goccia, i+100);
    //original coordinates of the duplicated clips
    _root.cont[goccia]._y = i*100+50;
    _root.cont[goccia]._x = -100;
    l.ivar = i*5+10;
    l.interval = setInterval(slide, l.ivar*100, 43.9, l);
}
// to move the clips into the stage from the left
function slide(targx, targM) {
    clearInterval(targM.interval);
    targM.onEnterFrame = function() {
        this._x += (targx-this._x)/20;
        if (Math.round(this._x) == targx) {
            this._x = targx;
            delete this.onEnterFrame;
        }
    };
};

```

/\*  
to duplicate the submenu clip (goccia1) using each title as a button,  
and using the numbers contained in the array[n] to quantify the number of submenu clips necessary for each title  
\*/

// this onRelease… is my problem connected to it?  
\_root.cont[goccia].onRelease = function() {  
count=0  
for (a=count; a\<count+n\*; a++) {  
//for (i=0; i\<n.length; i++) {  
goccia1 = “dropPix”+a;  
var l1 = \_root.cont.dropPix.duplicateMovieClip(goccia1, a+5);  
\_root.cont[goccia1].\_x = a_100+200;  
\_root.cont[goccia1].\_y = 1124;  
l.ivar1 = a_5+10;  
l.interval1 = setInterval(slide1, l.ivar1\*100, 630, l1);  
}  
// to make the clips slide get into the stage from the bottom  
function slide1(targy, targP) {  
clearInterval(targP.interval);  
targP.onEnterFrame = function() {  
this.\_y += (targy-this.\_y)/20;  
if (Math.round(this.\_y) == targy) {  
this.\_y = targy;  
delete this.onEnterFrame;  
}  
};  
}

Whoever can be bothered… is more than welcome! 😛  
Thanks’ guys  
Drey
