onKeyDown

Hi, I’m having a problem with onKeyDown.


Key.removeListener(listener7);
        if (Key.getCode() == 80) {
            if (upperrightdone == 0) {
                delete this.onEnterFrame;
                highlightupperleft.gotoAndStop(3);
                highlightupperright.gotoAndStop(4);
                gotoAndStop(8);
            } else {
                    if (lowerleftdone == 0) {
                    delete this.onEnterFrame;
                    highlightupperleft.gotoAndStop(3);
                    highlightlowerleft.gotoAndStop(4);
                    gotoAndStop(9);
                } else {
                    delete this.onEnterFrame;
                    highlightlowerright.gotoAndStop(4);
                    highlightupperleft.gotoAndStop(3);
                    gotoAndStop(10);
                }
            }
        }

There is a chunk of code like this for each of the four keys that are used. New keylisteners are deleted and added everytime the game moves back and forth between frames. However this seems to have caused a problem in that if you mash the keys (not just random ones but the ones assigned to various functions, we have built our own controller that only has four keys) down a lot or press multiple ones very quickly the game becomes non-responsive or fails to delete listeners. This leads to highlighted buttons and segments that shouldn’t be highlighted, and that will undoubtedly confuse the user. I was wondering if there was a way to ‘pad’ or protect the code against this somehow? This will be open to a large non-computer savvy public so…