# Need help with button arrays

**URL:** <https://forum.kirupa.com/t/need-help-with-button-arrays/244378>\
**Category:** Uncategorized\
**Created:** [November 17, 2007, 12:20am UTC](https://forum.kirupa.com/t/need-help-with-button-arrays/244378 "2007-11-17T00:20:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nosajB](https://avatars.discourse-cdn.com/v4/letter/n/3da27b/32.png) [@nosajB](https://forum.kirupa.com/u/nosajB)\
**Post date:** [November 17, 2007, 12:20am UTC](https://forum.kirupa.com/t/need-help-with-button-arrays/244378/1 "2007-11-17T00:20:43Z")

</div>

So I need a bit of help on this one.  
I have several arrays:  
[COLOR=Red]  
var linkNum:Number = 0;[/COLOR]  
[COLOR=Red]  
var linkArray:Array = new Array(“link1”, “link2”, “link3”, “link4”, “link5”);  
var btnArray:Array = new Array(btn1, btn2, btn3, btn4, btn5);[/COLOR]

and I’m using this function to animate the over/off and set the onRelease.

[COLOR=Red]function btnAction() {  
for (i=0; i\<btnArray.length; i++) {  
var btn = btnArray\*;  
btn.onRollOver = function() {  
this.tween("\_yscale", 600, .35, “easeOutQuart”, 0);  
};  
btn.onRollOut = function() {  
this.tween("\_yscale", 100, 1, “easeOutQuart”, .1);  
};  
btn.onRelease = btn.onReleaseOutside=function () {  
this.tween("\_yscale", 100, 1, “easeOutQuart”, .1);  
////-------do something (load swf)-------/////  
[/COLOR][COLOR=Black][COLOR=Red]linkNum ++  
trace (linkArray[linkNum])[/COLOR][/COLOR][COLOR=Red]  
};  
}  
}  
[/COLOR][COLOR=Black]My problem is I’m having a hard time getting the links to match their respective buttons.  
If I use some thing like this:

[COLOR=Red]linkNum ++  
trace (linkArray[linkNum])

[COLOR=Black]It just increments the array and I get a sequential trace in my output

I could do a separate onRelease for each of my buttons but I should be able to put all my links into an Array… But I can’t get it. Any help would be awesome.  
[/COLOR][/COLOR][/COLOR]
