Implicit coercion of a value of type X to an unrelated type X

Snote picture Snote · Aug 3, 2011 · Viewed 15.9k times · Source

Hi
I have this error :

Implicit coercion of a value of type X to an unrelated type X

where X is the type of the object and yes it's type X to an unrelated type X. It appears 6 times in my project, in 3 differents .mxml file, in the script element. It's in 3 files that I'm not editing and the file I has changing has no link with the 3 files with the errors.

Here a line of code with the problem.

var loadApplicationEvent:LoadApplicationEvent = new LoadApplicationEvent(application);

It was working perfect an when it was compiling and other file that I changed, it put me and error.

Bug from Flash Builder or Flex? Or not?
How can I get ride of it?

Answer

Chris picture Chris · Jan 26, 2012

I just ran into this issue myself with Flash Builder 4.5. The return type is exactly as it should be.

The solution for me was to do a full rebuild of the project via: Project -> Clean.