I am sending a name of a function via parameters to another function. This allows more usage of a single function. However, the button commands work every-so-often. Why? I know it’s not a scoping issue. The message appears everytime with no problem.
_root.msgReveal("This is just a random message. Click the ok button to close.", false, true, false, false, _level0.msgHide(), false);
function msgReveal(msgString:String, btn1B:Boolean, btn2B:Boolean, btn3B:Boolean, command1:Function, command2:Function, command3:Function) {
msg.messageBox._visible = true;
msg.messageBox.textF.htmlText = msgString;
msg.messageBox.btn1._visible = false;
msg.messageBox.btn2._visible = false;
msg.messageBox.btn3._visible = false;
if (btn1B) {
msg.messageBox.btn1._visible = true;
}
if (btn2B) {
msg.messageBox.btn2._visible = true;
}
if (btn3B) {
msg.messageBox.btn3._visible = true;
}
msg.messageBox.btn1.onRelease = function() {
command1();
};
msg.messageBox.btn2.onRelease = function() {
command2();
};
msg.messageBox.btn3.onRelease = function() {
command3();
};
}
function msgHide() {
msg.messageBox._visible = false;
msg.messageBox.textF.htmlText = "";
msg.messageBox.btn1._visible = false;
msg.messageBox.btn2._visible = false;
msg.messageBox.btn3._visible = false;
}
[COLOR=Red]Answered[COLOR=Black]: http://www.kirupa.com/forum/showthread.php?t=244264&goto=newpost
Thanks Nathan
[/COLOR][/COLOR]