Syntax error 1084 in Actionscript
I am getting 2 syntax errors out of this. I am new to Flash. How can I fix this?
var paddlepos:int = paddle.x.position
if; (paddlepos > 253)
{
paddle.x.postition = 253;
}
Syntax errors:
Scene 1, Layer 'Actions', Frame 1, Line 28 1084: Syntax error: expecting rightparen before leftbrace. Scene 1, Layer 'Actions', Frame 开发者_JAVA技巧1, Line 27 1084: Syntax error: expecting leftparen before semicolon.
Thanks.
There are multiple errors:
Your
if
statement doesn't need a semicolon:if (paddlepos > 253)
When referencing paddle's position, access the
x
property, as in:var paddlepos:Number = paddle.x; paddle.x = 253;
Terminate your first line with a semicolon, and note
x
should beNumber
:var paddlepos:Number = paddle.x;
This code could be reduced to:
if (paddle.x > 253)
{
paddle.x = 253;
}
The error on Line 27 tells you the exact reason. "Expecting leftparen before semicolon."
Move that semicolon from your "if;" to the end of your first line of code.
精彩评论