开发者

Can't use "continue <label>"

I am trying this code:

entLoop:for(var i:*in en开发者_JAVA技巧tities) {
    for(var i2:*in ignoreEntities) {
        if(entities[i].type==ignoreEntities[i2]) {
            continue entLoop;
        }
    }
}

Why is it not working? The error is:

Target of continue statement was not found.


I may be wrong, but it seems that the continue instruction doesn't work with for...in loops.

Compiler doesn't throw any error with this code :

entLoop:for(var i:Number = 0 ; i < 2 ; i++) {
  for(var i2:Number = 0 ; i2 < 2 ; i2++) {
    if(true) {
      continue entLoop;
    }
  }
}

(I replaced your condition by true since I don't have the definitions for your entities and ignoreEntities arrays)


I think you have to use break LABEL; instead.

From live docs : http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/statements.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜