Hellote, again. I am called Craig TH. Recently, I've been slacking off on working on my Flash cartoons, as I've been too preoccupied with ActionScript 2 programming. One thing I'm trying to accomplish is a text-based adventure, something that'll charm the nostalgic 70's-80's dwellers. Everything seems to be working out, but there's a problem with the input, known as "keyListener." Here is the code for the new Object().

Actionscript Code:
keyListener.onKeyDown = function ()
{
    lastKeyPressed = String.fromCharCode(Key.getAscii());
    a = Key.getCode();
    if (a == 40 || a == 13 && gAcceptInput)
    {
        trace ("You pressed enter!");
        inputSubmitted();
    } // end if
    if (a == 8 || a == 46 || a == 37)
    {
        input_mc.input.text = input_mc.input.text.slice(0, input_mc.input.text.length - 1);
        trace ("You pressed backspace!");
        return (true);
    } // end if
    b = lastKeyPressed.toLowerCase();
    if (b == "y" && gGameOver)
    {
        init();
    } // end if
    if (b == "n" && gGameOver)
    {
    } // end if
    if (gAcceptInput)
    {
        input_mc.input.text = input_mc.input.text + lastKeyPressed;
    } // end if
};
Key.addListener(keyListener);

All the letters that I type into the dynamic text known as "input" are coming out fine, however, at first, I was unable to backspace or press enter to submit my input. I tried some of the other options I'd put in, and it seemed that for backspacing, "37" (left arrow) is the only key that does what I want it to, and "40" (down arrow) is the only key that works for pressing enter. When I remove all the other options, nothing works. So I must acquire advice on how to extend "a" and "b" variables from just the arrow keys.

- Craig