# SetInterval used inside a Function not working

**URL:** <https://forum.kirupa.com/t/setinterval-used-inside-a-function-not-working/266449>\
**Category:** flash\
**Created:** [July 20, 2008, 9:05pm UTC](https://forum.kirupa.com/t/setinterval-used-inside-a-function-not-working/266449 "2008-07-20T21:05:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)\
**Post date:** [July 20, 2008, 9:05pm UTC](https://forum.kirupa.com/t/setinterval-used-inside-a-function-not-working/266449/1 "2008-07-20T21:05:23Z")

</div>

If I place some working setInterval code within a function and then call the function, it fails:

```auto

function RevealLinks():Void {
    menu_mc._visible = true;
    // Begin with Menu Links hidden
    for (var i = 0; i < 12; i++) {
        _root.menu_mc["item" + i + "_mc"]._visible = false;
    }
    clearInterval(thisID);
    var thisID:Number;
    var count:Number = 0;
    var maxCount:Number = 11;
    var duration:Number = 100;
    function executeCallback():Void {
        _root.menu_mc["item" + count + "_mc"]._visible = true;
        if (count >= maxCount) {
            clearInterval(thisID);
        }
        count++;
    }
    thisID = setInterval(this, "executeCallback", duration);
}
RevealLinks();

```

Can someone remind me why this sort of thing doesn’t work?
