# Check if function is finished

**URL:** https://forum.kirupa.com/t/check-if-function-is-finished/84329
**Category:** Uncategorized
**Created:** [March 26, 2005, 11:48am UTC](https://forum.kirupa.com/t/check-if-function-is-finished/84329 "2005-03-26T11:48:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)
#### Post date: [March 26, 2005, 11:48am UTC](https://forum.kirupa.com/t/check-if-function-is-finished/84329/1 "2005-03-26T11:48:14Z")

</div>

hi i’ve got this code:

```auto

_root.done = "a";
var myListener = new Object();
myListener.onKeyDown = function() {
    switch (Key.getCode()) {
    case Key.LEFT :
    trace(_root.done);
        if(_root.done == "a"){
            _root.done == "z";
            back();
            
        }
        break;
    case Key.RIGHT :
        trace(_root.done);
        if(_root.done == "a"){
            _root.done == "z";
            further();
        }
        break;
    }
};
Key.addListener(myListener);
function further() {
    trace(_root.done);    
    if ((content._y-312)>(0-content._height)) {
        trace((content._y-312.1)+" -- "+(0-content._height));
        targety = content._y-312;
        content.onEnterFrame = function() {
            disty = (targety-this._y);
            this._y += disty/3;
            if (disty>-0.1) {
                this._y = Math.floor(this._y);
                _root.done == "a";
                delete this.onEnterFrame;
            }
        };
    }
}
function back() {
    trace(_root.done);
    if ((content._y+0.1)<0) {
        trace((content._y+0.1)+" --- "+(0-content._height));
        targety = content._y+312;
        content.onEnterFrame = function() {
            disty = (targety-this._y);
            this._y += disty/3;
            if (disty<0.1) {
                this._y = Math.ceil(this._y);
                _root.done == "a";
                delete this.onEnterFrame;
            }
        };
    }
}

```

what i want is that when you press the left or right key the back or further function is only processed when \_root.done = “a” (or true something else)… but now it doesn’t work… \_root.done is always “a”… who can help me out?

thanks 😃
