Trouble Targeting Clip

I’m having trouble targeting a clip using variables. All the code works, except the lines targeting the clip. “currentMenu” and “nextMenu” keep coming up undefined. The following code is on the root timeline, targeting a clip embedded in the mainClip instance. Can someone tell me what is wrong with my syntax?


this.onEnterFrame = function() {
    if (currentNum != nextNum) {
        currentMenu = this["menuClip_"+currentNum];
        nextMenu = this["menuClip_"+nextMenu];
        mainClip.currentMenu.targetFrame = 2;
        if (mainClip.currentMenu._currentframe == 3) {
            mainClip.nextMenu.targetFrame = 31;
            currentNum = nextNum;
        }
    }
};