1

I'm new with actionscript and I keep getting syntax error with the following for loop:

for each (target:Target in targets) {
  if(target != null) {
    target.parent.removeChild(target);
  }
}

And I got this error message:

Syntax error: expecting in before colon.

What is the problem?

1 Answer 1

2

You forgot to declare the variable, it should be:

for each (var target:Target in targets) {
    // …
}

Note the var.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.