"Nonunique object in package" error continues to show in Flex project

I have a fairly complex flex project that I'm compiling, but I keep getting a red error on the root tag in my mxml files saying "Nonunique object in package" for even mx classes.  I've never seen this before in other Flex projects I have, but this one is my most complex project.  I can compile the project fine in IntelliJ and run it.  So it's just a disconnect between the IDE dynamic error highlighting and the compiler.

Maybe some simple discussion about the project might help track this down.  I have four Flex projects.  

Project A -> compiled as a SWC, depends on some external libraries (SWC).
Project B -> compiled as a SWC, depends on Project A, depends on some external libraries (SWC)
Project C -> compiles to a SWF that is loaded dynamically, Depends on Project B
Project D -> compiles to a SWF, depends on Project A and B, and external libraries (SWC).

The external dependencies are defined as a global library with all the SWC's added to that library.  That library is then a dependency on A, B, and D.  All of these projects depend on the AIR 3.5 SDK.

It seems to be mostly files in project D that use Script source= code behind pattern.  I also get a lot of errors in those files because it doesn't see them as belonging to the mxml file they are being included into.

I'm using: 9.0.3, Mac OSX 10.6.

Any help how to fix this so my IntelliJ is really the best IDE?  :-)  Right now I'm stuck at like 80% awesome.

Comment actions Permalink

I have the same issue when there is a mxml file called in a similar way as a actionScript file.
For example if I have a view "PersonView.mxml" and its controller "personview.as" in the same package.
It seems IntelliJ won't distinguise the upper/lower case diferences in the filenames, so for IntelliJ there is a conflict between the files, giving the "Nonunique object in package" error.

Although.it compiles perfectly, it's a bit annoying.

Comment actions Permalink

I have the same error, for instance:app_error.png
I checked ( grep -ri mx:Application *) and there is no other file that contains mx:Application

Another error:
In a .as file that includes a mxml file that imports the Timer class:

private var clockTimer:Timer = new Timer(1000);
the error "Initializer type flash.utils.Timer is not assignable to variable type Timer"



Comment actions Permalink

This issue still exists in IDEA 11.1.3.

The most obvious way to replicate it is to have a script file matching the same name as the mxml file, but differing in extension.  eg: MyApp.mxml and MyApp.as.

This would be nice to fix, as this bug obliterates the usefulness of the red squiggly underline in the project browser which cleanly indicates what files need attention.


Comment actions Permalink

I observe following:
- If you have SomeClass.mxml and SomeClass.as referenced from <Script source=SomeClass.as"/>, and SomeClass is not the main class of the application, but referenced somehow from the main class then Flex compiler gives error, so in this case red highlighting in IntelliJ IDEA seems to be correct.

- The same, but SomeClass IS the main app class - indeed compiler gives no error, though highlighting in IntelliJ IDEA is the same.

Can you confirm that you have undesirable red highlighting only for main mxml class?

Comment actions Permalink

Changing the ActionScript file name from the MXML file resolved this issue for me.


Please sign in to leave a comment.