Tuesday, July 27, 2010

The name of this class conflicts with the name of another class that was loaded.

Generally I try to avoid dead dreadful programming languages and if you've ever programmed in ActionScript 2.0, you can see why. Among all the problems that come with programming in AS2.0, there is one that seems to cause quite a stir among developers. The 'conflicts with the name of another class' error popups up out of no where and ruins your day. If your on a time critical project, this error alone may be enough to inspire you to quit your job. However, don't submit your 2 weeks notice yet. There may be a couple more things you can try.

Problem:
When trying to compile ActionScript 2.0 code, the error The name of this class, 'ClassName', conflicts with the name of another class that was loaded, 'ClassName'. popups up out of nowhere.

More Information:
Flash likes to make it's job easier when compiling AS2.0 code and chooses to cache compiled byte code for classes you have written. If these classes appear not to change between compiles, then you may just find yourself getting the error mentioned above. The way that Flash determines if something has been changed in your class is by looking at the time stamp on the file. If you have classes on a server with an incorrect time, then your server might be assisting in this problem.

Solution:
To fix this problem we need to look at several things. First we need to make sure the time stamp of the classes being loaded in now later (in the future) than the current time noted on your local machine's clock. If you have had problems with the conflicts error, you will most likely need to clear the ASO files before your next compile. The Flash IDE provides a quick way to delete ASO files and test your movie (listed under the Control menu).

Hopefully this helps others to not have to suffer (as much as can be helped with programming AS2.0) as we have. Good luck.

No comments: