# \[MX\] function not working! :(

**URL:** <https://forum.kirupa.com/t/mx-function-not-working/25246>\
**Category:** flash\
**Created:** [July 10, 2003, 9:18pm UTC](https://forum.kirupa.com/t/mx-function-not-working/25246 "2003-07-10T21:18:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felipe\_Bastos](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@Felipe\_Bastos](https://forum.kirupa.com/u/Felipe_Bastos)\
**Post date:** [July 10, 2003, 9:18pm UTC](https://forum.kirupa.com/t/mx-function-not-working/25246/1 "2003-07-10T21:18:01Z")

</div>

Hey everybody!  
I have the following problem:  
I have a function that names 9 buttons.  
btn21 - btn29

```auto
function mouseRelease() { // LAYER AS; FRAME1; LINE 76!!!
	pos = 85;
	for (var a=1; a<10; a++) {
		var btn = _root.mc_A.submenu2["btn2"+a];
		if (btn == this) {
			var visitedcolor = new Color(this);
			visitedcolor.setRGB(0xFFFFFF);
			this.enabled = false;
			this._x = this._x + 10;
		} else {
			var visitedcolor = new Color(this);
			visitedcolor.setRGB(0xA5A5A5);
			_root.mc_A.submenu2["btn2"+a].enabled = true;
			_root.mc_A.submenu2["btn2"+a]._x = pos;
		}
	}
}
	for (var a=1; a<10; a++) {
		_root.mc_A.submenu2["btn2"+a].onRelease = mouseRelease;
	}

```

All the other functions (look at the fla) are workin fine.  
Do the following: open the layout01.swf - click on TRABALHOS and try all the buttons. [color=red]Notice that only the last button changes its color to white.  
I cant figure this out. (look at LINE 80)[/color]

Thanks  
Van Basten

---

<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:** [July 10, 2003, 9:28pm UTC](https://forum.kirupa.com/t/mx-function-not-working/25246/2 "2003-07-10T21:28:19Z")

</div>

Hey, I finally figured it out!  
The reference to the buttons in the var color was wrong  
This is the correction: var normalcolor = new Color(\_root.mc\_A.submenu2[“btn2”+a]);  
Thanks anyway!  
🙂

```auto
// FUNCTION FOR SUBMENUS` BUTTONS
function mouseRelease() {
	pos = 85;
	for (var a=1; a&lt;10; a++) {
		var btn = _root.mc_A.submenu2["btn2"+a];
		if (btn == this) {
			var visitedcolor = new Color(this);
			visitedcolor.setRGB(0xFFFFFF);
			this.enabled = false;
			this._x = this._x + 10;
		} else {
			var normalcolor = new Color(_root.mc_A.submenu2["btn2"+a]);
			normalcolor.setRGB(0xA5A5A5);
			_root.mc_A.submenu2["btn2"+a].enabled = true;
			_root.mc_A.submenu2["btn2"+a]._x = pos;
		}
	}
}
	for (var a=1; a&lt;10; a++) {
		_root.mc_A.submenu2["btn2"+a].onRelease = mouseRelease;
	}

```

---

<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:** [July 10, 2003, 9:28pm UTC](https://forum.kirupa.com/t/mx-function-not-working/25246/3 "2003-07-10T21:28:30Z")

</div>

I get an unexpected file format.  
Im on PC and Flash MX
