I need to add a KeyboardEvent to a movie clip in Flash cs4 AS 3.0
Posted
by psy-sci
on Stack Overflow
See other posts from Stack Overflow
or by psy-sci
Published on 2010-04-19T19:19:05Z
Indexed on
2010/04/19
19:23 UTC
Read the original article
Hit count: 218
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.
© Stack Overflow or respective owner