Turning listeners on and off

Hi all,
Wondering if someone can point me in the right direction. I’m doing a simulation with some screens learners have to step through. On the software, they input code(s) in a field(s) and press “Enter” and the screens populate. I’ve got everything setup but what I am trying to do is:

after the code is entered correctly the “Enter” key enables, advances to the next frame (when they press enter) and then disables for the next screen.

I’ve managed to setup the “Enter” key to advance the frame with this listener. The problem is that it activates when the frame is entered and they could just skip through the sim without inputting anything. So I need to have it come on after the condition is met.

Listener:


 
//This movie clip detects if the enter key has been pressed and then advances the screen to the next 
onClipEvent (load) {
Key.addListener(myListener);
    EnterKeyListener = new Object();
    EnterKeyListener.onKeyDown = function() {
        if (Key.getCode() == "13") {
           _root.nextFrame();
        }
    };
    Key.addListener(EnterKeyListener);
}

I already have something setup to recognize when the code is entered correctly. Right now I have some popups come on and a sound play. Is there a line I can add to this that will enable the listener


onClipEvent (load) {
 this.onEnterFrame = function() {
  //The correct answer RVSI20
  if (_root.InStratCode == "RVSI20") {
   _root.audioCorrect_mc.play();
   //I have some information screens set to popup as well
   setProperty(_root.confirm01,_visible,true);
   setProperty(_root.enter1,_visible,true);
}
    }
 }

I’m pretty new to Flash so it might be something obvious I’m missing. I’ve looked at dozens of sites but still can’t figure out this and it’s driving me nuts. Thanks in advance if you can help :slight_smile:

Bob