Reputation: 103
On flash CS6 Actionscript 3.0, I am getting this error code.
Scene 1, Layer 'good guy', Frame 1, Line 23 1084: Syntax error: expecting identifier before assign.
What is this error? I do not understand.
Here is my code.
`import flash.events.MouseEvent;
var mouseIsDown = false;
stage.addEventListener(MouseEvent.MOUSE_DOWN, clicked);
stage.addEventListener(MouseEvent.MOUSE_UP, unclicked);
function clicked (n:MouseEvent)
{
mouseIsDown = true;
}
function unclicked (n:MouseEvent)
{
mouseIsDown = false;
}
addEventListener(Event.ENTER_FRAME, mainLoop);
function mainLoop (e:Event)
{
if (mouseIsDown)
{
gg_mc.y -= 10
}
else
{
gg_mc.y +
= 10
}
for (var I = 0; I < numChildren; I++)
{
if (getChildAt(I) is bad)
{
var b = getChildAt(I) as bad;
if (b.hitTestObject(gg_mc))
{
trace ("You got hit! GAME OVER")
}
}
}
}
Upvotes: 0
Views: 336
Reputation: 14406
That error means you have a formatting error in your code.
This line:
gg_mc.y +
= 10
There should be no line break or space there
gg_mc.y += 10;
Also,
`import flash.events.MouseEvent;
That quote at the start is invalid, take it out.
Upvotes: 2