flexbuilder update gotcha: package/var name collision

After updating my trial of FlexBuilder to 2.0.1 (OS X), a slew of errors appeared in my AS3 projects.

I had gotten in the habit of using the same name for 1) a package, 2) the most important class in that package, and 3) a reference to that class in another class.

So for instance:

import alertBox.AlertBox;

protected var alertBox:AlertBox

I had a queasy feeling about possible collisions, but I found the symmetry clear and effortless, and there were no problems–until the update.

Then, the compiler started disregarding the variable declaration, and treating “alertBox” as the package, instead, so I got a bunch of errors to the effect that “x” (for instance) is not a method defined for alertBox. (”x” is a property of an alertBox instance, but not a class in the alertBox package).

When I renamed the variables (”aBox”), the errors went away.

Just a heads up.

One comment.

  1. Your new blog seems getting some URL collision too….

Post a comment.