Hi - I have some functions that when applied directly to buttons work as planned, but when I create a function from them to apply to the array, they fail to execute properly.
Trace tells me the arrays are being parsed correctly, so the problem is in the functions themselves.
This function is meant to set all 56 buttons to alpha 0, and as unselected.
What happens is the buttons flash onscreen at 100% before setting to alpha 0. They do behave as if unselected, but don’t know if that’s due to the code.
for (_root.i = 0;i<56;i++){
_root["btn"+_root.i].onEnterFrame = function() {
this._alpha = 0;
this.bSelected = false;
this.onEnterFrame = null;
}
}
This function should fade the button up on rollover. But on rollover the button only increase by 10% then stops. Each subsequent rollover increases it another 10%.
for (_root.i = 0;i<56;i++){
_root["btn"+_root.i].onRollOver = function() {
this._alpha<100 ? this._alpha += 10 : this.onEnterFrame = "";
}
}
This function should fade the button out on rollout. Since the rollover increases them only by 10% increments (above), the result is the buttons just bounce back and forth between alpha 20 and 30.
for (_root.i = 0;i<56;i++){
_root["btn"+_root.i].onRollOut = function() {
(this._alpha>20 && this.bSelected==false) ? this._alpha -= 10 : this.onEnterFrame = "";
}
}
Last one =)
this function should set several behaviors on release. Right now none of them appear to work.
for (_root.i = 0;i<56;i++){
_root["btn"+_root.i].onRelease = function() {
this.bSelected = true;
this.enabled = false;
pastBtn.enabled = true;
pastBtn._alpha = 20;
pastBtn.bSelected = false;
pastBtn = this;
}
}
Thanks for your help. :puzzled: