I need to add a KeyboardEvent to a movie clip in Flash cs4 AS 3.0
- by psy-sci
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.SPACE)
{
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.