# Simple Array variable question (hopefully)

**URL:** https://forum.kirupa.com/t/simple-array-variable-question-hopefully/240209
**Category:** flash
**Created:** [September 30, 2007, 11:37pm UTC](https://forum.kirupa.com/t/simple-array-variable-question-hopefully/240209 "2007-09-30T23:37:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ginowhitaker](https://avatars.discourse-cdn.com/v4/letter/g/c6cbf5/32.png) [@ginowhitaker](https://forum.kirupa.com/u/ginowhitaker)
#### Post date: [September 30, 2007, 11:37pm UTC](https://forum.kirupa.com/t/simple-array-variable-question-hopefully/240209/1 "2007-09-30T23:37:04Z")

</div>

I’m having trouble understanding why my i variable in this script doesn’t carry through to the " mySubMenus\*.alphaTo (100,1);" line. When I trace it returns a value of 3, but it’s working for myButtons\*. There must be a way to pass that \* value someplace else, but I can’t figure it out. Any one have any ideas?

BTW, this is a variation of one of the mc\_tween samples. Thanks!

var myButtons = [this.servicesBtn, this.portfolioBtn, this.peopleBtn];  
var mySubMenus = [this.servicesLevel2, this.portLevel2, this.peopleLevel2];

// Loops on all buttons from the first to the last one  
for (var i=0; i\<myButtons.length; i++) {

```
myButtons*.onRollOver = function() {
    this.colorTo(0xFFFFFF,.25,"easeOutSine");
};

myButtons*.onRollOut = myButtons*.onReleaseOutside = function() {
    this.colorTo(0xCCCCCC,.25,"easeOutSine");
};

myButtons*.onRelease = function() {
    this._parent.activateItem (this);

```

// \*\*\* Function here

```
    this.blueArrow.alphaTo (100, 1);
    mySubMenus*.alphaTo (100,1);
};

```

}

this.activateItem = function(item) {  
// Function that activates a button.

```
// Checks if there's an activated item already; if so, deactivates it.
if (this.currentItem != false) this.deActivateItem();

// Activates it, finally
this.currentItem = item;
this.currentItem.colorTo(0x4F89AB,.25,"easeOutSine"); // makes it 'disabled'
this.currentItem.enabled = false; // makes it a disabled button, so it won't receive mouse events

```

};

this.deActivateItem = function() {  
// Deactivates the current activated menu item.  
this.currentItem.enabled = true; // back to a normal button/movieclip  
this.currentItem.colorTo(0xCCCCCC,.25,“easeOutSine”); // back to its original color  
this.currentItem.blueArrow.alphaTo (0, 1);  
mySubMenus\*.alphaTo (0,1);  
this.currentItem = undefined;  
};

this.stop();
