Reputation: 3
I'm fairly new to action script and I was wondering if any of you guys would be able to solve my problem.
function keyDown (keyEvent:KeyboardEvent):void
{
if (keyEvent.keyCode == Keyboard.D
{
rightPressed = true;
}
else if (keyEvent.keyCode == Keyboard.A
{
leftPressed = true;
}
else if (keyEvent.keyCode == Keyboard.S
{
downPressed = true;
}
else if (keyEvent.keyCode == Keyboard.W
{
upPressed = true;
}
}
I thought the code was fine, however whenever I run it I always get the "1084: Syntax error: expecting right parent before leftbrace" error.
Upvotes: 0
Views: 1689
Reputation: 56
You forgot to close your parenthesis. Like this
if (keyEvent.keyCode == Keyboard.D)
You have it like this
if (keyEvent.keyCode == Keyboard.D
Upvotes: 2