I'm new to ActionScript and I'm confused about these two errors. I already have some prior coding experience from other languages.
Scene 1, Layer 'Actions', Frame 1, Line 78, Column 20 1084: Syntax error: expecting rightparen before colon.
Scene 1, Layer 'Actions', Frame 1, Line 85, Column 20 1084: Syntax error: expecting rightparen before colon.
This is my code.
function moveCharacter(evt:KeyboardEvent):void
{
if (evt.keyCode == Keyboard.RIGHT)
{
eggHead.scaleX = 1; //flip right
eggHead.x += 10;
//cycle through frames
if (eggHead.currentFrame == 9)
{
eggHead.gotoAndStop(2);
}
else
{
eggHead.gotoAndStop(eggHead.currentFrame+1);
}
}
if (evt.keyCode == Keyboard.LEFT)
{
eggHead.scaleX = -1; //flip left
eggHead.x -= 10;
//cycle through frames
if (eggHead.currentFrame == 9)
{
eggHead.gotoAndStop(2);
}
else
{
eggHead.gotoAndStop(eggHead.currentFrame+1);
}
}
}
function timing(evt:TimerEvent):void
{
timeStep += 1; //increment counter
if (run)
{ //only if run = true is shift key has been pressed
moveCharacter(evt:KeyboardEvent)
{
timeStep = 0; //reset the counter
}
}
else if (timeStep == 2)
{
moveCharacter(evt:KeyboardEvent)
{
timeStep = 0; //reset the counter
}
}
}
Lines 78 and 85 are the moveCharacter(evt:KeyboardEvent)
function.
I'm not sure where the problem is, I can't see one, unless I'm blind.