0

是否可以执行多个 if 语句?我正在尝试使以下内容起作用:

stop();

continueb_lilmine3.addEventListener(MouseEvent.CLICK, overHandler);

function overHandler(evt:MouseEvent):void
{
      if(MovieClip(root).lilmine_cell4.currentFrame == 3)
      if(MovieClip(root).lilmine_cell2.currentFrame == 3)
      {MovieClip(parent).gotoAndStop(5);

  }else{
{gotoAndStop(3);
}}}

ifs 似乎有效,但 else 无效。它说卡在 continueb_lilmine3 MC 的第 2 帧上。

4

1 回答 1

0

Your syntax is a bit off. An if statement should have a code block (or a single line of code) after it.

[Edit]

I believe your code seems to work, because according to the compiler, your first if statement is followed by exactly one statement -- the if/else construct. So in effect, perhaps your code is doing this:

if(MovieClip(root).lilmine_cell4.currentFrame == 3)
{
    if(MovieClip(root).lilmine_cell2.currentFrame == 3)
    {
        MovieClip(parent).gotoAndStop(5);

    }
    else {
        {gotoAndStop(3);} // unnecessary brackets here?
    }
}

And thus the else never executes.

[end]

[Edit #2] Here is what you are probably after:

if (MovieClip(root).lilmine_cell4.currentFrame == 3 && MovieClip(root).lilmine_cell2.currentFrame == 3)
{
    MovieClip(parent).gotoAndStop(5);
}
else
{
    gotoAndStop(3);
}
于 2012-05-22T00:27:06.280 回答