PDA

View Full Version : [MX] function not working! :(



Felipe Bastos
July 10th, 2003, 05:18 PM
Hey everybody!
I have the following problem:
I have a function that names 9 buttons.
btn21 - btn29


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. Notice that only the last button changes its color to white.
I cant figure this out. (look at LINE 80)

Thanks
Van Basten

Felipe Bastos
July 10th, 2003, 05:28 PM
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!
:)

// FUNCTION FOR SUBMENUS` BUTTONS
function mouseRelease() {
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 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<10; a++) {
_root.mc_A.submenu2["btn2"+a].onRelease = mouseRelease;
}

claudio
July 10th, 2003, 05:28 PM
I get an unexpected file format.
Im on PC and Flash MX