I have a movieclip called keyCButton that I want to add a keyboardEvent ("C" Key) to. This will play an animation from frames 2-30 with a sound. I have watched a few tutorials but still haven't gotten the correct information to make it work. The following is my code.
stage.addEventListener(KeyboardEvent.KEY_DOWN, cNote);
function cNote(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.C)
{
keyCButton.gotoAndPlay(2)
}
}
at frame 30 the code tells it to stop and then go back to frame 1
This works for the MouseEvent.CLICK but the KeyboardEvent does nothing. It returns this error for the if condition
1119: Access of possibly undefined property C through a reference with static type Class.
When I try it with the SPACE instead of C i don't get errors but it still doesn't work