onKeypress , on event handler

I have a triangle placed on scene that I can control when I press up arrow,down ,left and right arrow.

Here is the code:


onClipEvent(enterFrame)
{
}
on (keyPress "<Left>") {
    this._x -= 10;
}
on (keyPress "<Right>") {
    this._x += 10;
}

on (keyPress "<Down>") {
    this._y += 12;
}
on (keyPress "<Up>") {
    this._y -= 12;
}

My question is if I can use on(keypress) on touching a certain key to display me in output panel that I press ESC for example to display me ESCAPE key was pressed.

So when I press ESC I want to display a message in output. How can I do that?

I try this (I want to perform several displays):



on(keyPress "<Escape>")
{
trace("ESCAPE key was pressed");
}

on (keyPress "<Home>")
{trace("HOME key was pressed");
}

on(keyPress "<Insert>")
{trace("INSERT key was pressed");
}

on(keyPress "<Space>")
{trace("SPACE key was pressed");
}

on(keyPress "<Delete>")
{trace("DELETE key was pressed");
}

Please help! If it’s possible to get Ascii code from ESC key display it and then display that message in trace all these in output panel.