# Assigning number (arrays?) for Buttons

**URL:** <https://forum.kirupa.com/t/assigning-number-arrays-for-buttons/274766>\
**Category:** flash\
**Created:** [November 4, 2008, 12:55pm UTC](https://forum.kirupa.com/t/assigning-number-arrays-for-buttons/274766 "2008-11-04T12:55:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyle\_artbow](https://avatars.discourse-cdn.com/v4/letter/k/4bbf92/32.png) [@kyle\_artbow](https://forum.kirupa.com/u/kyle_artbow)\
**Post date:** [November 4, 2008, 12:55pm UTC](https://forum.kirupa.com/t/assigning-number-arrays-for-buttons/274766/1 "2008-11-04T12:55:14Z")

</div>

Hi! I need your help. I have got an actionscript here that I can’t figure out. I have movie clipped buttons with instances 1,2,3, and so on. Each has to have an assigned “num” with it so it can be traced by another movie clip. However, if I include the code on the movie clipped button itself, it doesnt work. I was able to work around it but now I’m stuck here.

I can’t explain it well as I am not very good with Actionscripting. Anyway, I will paste the code here so you’d have an idea what I’m talking about.

\_global.open = false;  
/_link = new Array();  
link[1] = “02.html”;  
link[2] = “02.html”;  
link[3] = “02.html”;  
link[4] = “02.html”;  
link[5] = “02.html”;  
link[6] = “02.html”;  
frame = new Array();  
frame[1] = “\_self”;  
frame[2] = “\_self”;  
frame[3] = “\_self”;  
frame[4] = “\_self”;  
frame[5] = “\_self”;  
frame[6] = “\_self”;_/  
num = new Array();  
num[1] = 2;  
num[2] = 3;  
num[3] = 4;  
num[4] = 5;  
num[5] = 6;  
num[6] = 7;  
num[7] = 8;  
numOfMenu = 7;  
\_global.active = \_root.pageNum;  
\_global.over = active;  
for (i = 1; i \<= numOfMenu; i++)  
{  
this\*.onEnterFrame = function(){  
num[this.parent.\_name];  
}

```
this*.bg.onRollOver = function ()
{
    _global.over = this._parent._name;
    _global.open = true;
};
this*.bg.onRollOut = this*.bg.onDragOut = function ()
{
    _global.over = active;
    _global.open = false;
};

/*this*.bg.onRelease = function ()
{
    getURL(link[this._parent._name], frame[this._parent._name]);
};*/

this*.bg.onRelease = function (){
if (_root.monClip.link != num && _root.monClip.animation == 1)
{
    _root.monClip.animation = 0;
    _root.monClip.link_prev = _root.monClip.link;
    _parent["list" + _root.monClip.link].gotoAndPlay("s2");
    _root.corner_B_D_mc["list" + _root.monClip.link].gotoAndPlay("s2");
    _root.monClip.link = num;
    _root.monClip.play();
    _root.corner_B_D_mc.menu.play();
} // end if

```

}

```
this*.onEnterFrame = function ()
{
    var _l1 = this;
    if (over == _l1._name)
    {
        _l1.nextFrame();
    }
    else
    {
        _l1.prevFrame();
    } // end if
};

```

} // end of for  
this.onEnterFrame = function ()  
{  
if (open)  
{  
this.\_parent.nextFrame();  
}  
else  
{  
this.\_parent.prevFrame();  
} // end if  
};  
/\*viewBtn.bg.onRollOver = function ()  
{  
\_global.open = true;  
};  
viewBtn.bg.onRollOut = function ()  
{  
\_global.open = false;  
};  
\*/

Thank you for your help!
