开发者

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:

  1. Your if statement doesn't need a semicolon:

    if (paddlepos > 253) 
    
  2. When referencing paddle's position, access the x property, as in:

    var paddlepos:Number = paddle.x;
    paddle.x = 253;
    
  3. Terminate your first line with a semicolon, and note x should be Number:

    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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜