Question

I am trying this code:

entLoop:for(var i:*in entities) {
    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.

Was it helpful?

Solution

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)

OTHER TIPS

I think you have to use break LABEL; instead.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top