[HELP] Prevent doubling an action when two keys are pressed together

I’m in the very early stages of developing a platform game in Flash CS3 using ActionScript 2. Previously, I’ve always just instructed the player to use the WASD keys to control the player. In this game, I’m adding the possibility to use either WASD or arrow keys.

The problem that I’ve run into, is that when two keys that perform the same action (the right arrow and “d” key for example) the action is performed twice. How can I disable one key if the other is being pressed?

Here’s the code I’m working on: http://pastie.org/9665826[1]

Any tips?

I would write the controls more like this:

if(Key.isDown(Key.RIGHT) || Key.isDown(68)){ _x += speed }

That way you don’t duplicate code that does the same thing just because two different buttons activate it. It also avoid the action doubling problem.