AS3语法编译错误 - 在rightparen之前期待分号

时间:2012-12-20 15:20:43

标签: actionscript-3 flash multi-touch flash-cs6

我知道这是非常基本的,但是以下函数在编译时会产生2个语法错误,如下所示。我无法弄明白。非常感谢任何帮助。

Game, Layer 'Actions', Frame 2, Line 5  1086: Syntax error: expecting semicolon before rightparen.

Game, Layer 'Actions', Frame 2, Line 5  1084: Syntax error: expecting rightbrace before semicolon.



function fl_TouchEndHandler_2(event:TouchEvent):void {
    // Drag & drop stuff...
    contained[i] = Gem1_MC.hitTestObject(Gem4_MC));
    contained[i] = Gem2_MC.hitTestObject(Gem4_MC));
    contained[i] = Gem3_MC.hitTestObject(Gem4_MC));
    if (contained.indexOf(false) == -1) { // This returns -1 if it can't find false
        gotoAndStop(1);
    }
}

1 个答案:

答案 0 :(得分:2)

你有额外的')'

尝试:

function fl_TouchEndHandler_2(event:TouchEvent):void {
   // Drag & drop stuff...
   contained[i] = Gem1_MC.hitTestObject(Gem4_MC);
   contained[i] = Gem2_MC.hitTestObject(Gem4_MC);
   contained[i] = Gem3_MC.hitTestObject(Gem4_MC);
   if (contained.indexOf(false) == -1) { // This returns -1 if it can't find false
      gotoAndStop(1);
   }
 }