# Script works 70% of the time!

**URL:** <https://forum.kirupa.com/t/script-works-70-of-the-time/216416>\
**Category:** flash\
**Created:** [February 16, 2007, 6:32am UTC](https://forum.kirupa.com/t/script-works-70-of-the-time/216416 "2007-02-16T06:32:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbailey](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jbailey/32/2380_2.png) [@jbailey](https://forum.kirupa.com/u/jbailey)\
**Post date:** [February 16, 2007, 6:32am UTC](https://forum.kirupa.com/t/script-works-70-of-the-time/216416/1 "2007-02-16T06:32:01Z")

</div>

:h: The following script works 70% of the time. I don’t have a clue as to why.

In a child MC for a button

```auto
_root.msgReveal(thisLocation+".Remove", true, false, true, "msgHide", false, thisLocation+".Remove");

```

Root

```auto
function msgReveal(msgString:String, btn1B:Boolean, btn2B:Boolean, btn3B:Boolean, command1:String, command2:String, command3:String) {
    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() {
        this._parent._parent._parent.msg.messageBox.textF.text = command1;
        this._parent._parent._parent.callFunction(command1);
        //root[command1]();
    };
    msg.messageBox.btn2.onRelease = function() {
        this._parent._parent._parent.msg.messageBox.textF.text = command2;
        this._parent._parent._parent.callFunction(command2);
        //root[command2]();
    };
    msg.messageBox.btn3.onRelease = function() {
        this._parent._parent._parent.msg.messageBox.textF.text = command3;
        this._parent._parent._parent.callFunction(command3);
        //root[command3]();
    };
}
function callFunction(callUpon:String):Void {
    //root[callUpon]();
    eval(callUpon)();
    msg.messageBox.textF.text = callUpon;
}
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;
}

```
