reidLinden
reidLinden

Reputation: 4160

Could not resolve * to a component implementation

I'm a wee bit stuck on this, and was hoping you might have some input to help me.

I'm getting the "Could not resolve * to a component implementation." error message. However, everything I've read about this via Google hasn't helped my case in the slightest. I presume I'm just missing something obvious, but maybe its something more serious.

So, to solve this problem, I've tried two things, and both work, as far as they take me. First, I added a new component, of the exact same variety, and then copied the contents of the erroring component into it. I replace the viewstack 'page' with the new component (which as near as I can tell is IDENTICAL, but with a different name), and the compiler error goes away.

I can also solve this by simply renaming the original component & letting FB4 refactor for me. The error goes away again. But if I then re-rename back to the original name, I get the compiler error again.

I've tried to clean the project several times, and that doesn't help. Neither does deleting the workspace, and re-importing the project.

I'd really like to understand what I've done wrong here. What am I missing?

Thanks much!

Upvotes: 3

Views: 19829

Answers (5)

Justin Ohms
Justin Ohms

Reputation: 3523

One cause of this error is that the default xml namespace for the component is not the same as the the package in which the component resides.

Check to make sure that the default xmlns entry in the component definition is the same as the package.

For example:

If you have an component MyControl.mxml located in the package com.company.components.controls

The mxml opening tag might look something like this:

<MyControl xmlns:mx="http://www.adobe.com/2006/mxml"
           xmlns:util="com.company.components.util.*"
           xmlns:components="com.company.components.*"
           xmlns="com.company.components.controls.*">

Note how the default xmlns entry points to the same package.


Why this happens:

What often happens is that after you refactor an MXML class by moving it to a new package you will end up with a an valid but not correct mxml definition.

For example say I refactor and move the MyControl.mxml from the com.company.components package to the com.company.components.controls package. The xmlns definitions will not be updated so they will look like this:

<controls:MyControl xmlns:mx="http://www.adobe.com/2006/mxml"
                    xmlns:util="com.company.components.util.*"
                    xmlns="com.company.components.*"
                    xmlns:controls="com.company.components.controls.*">

Note how the default namespace still points to the com.company.components package and the mxml tag MyControl has to be prefixed by the namespace controls this is an indication of the issue.

Now here is the catch; This is technically valid and will often work. The reason is that it is valid and the components can all be found in their defined xmlns locations.

The problem comes when you try to use a component that is expected to be found, by the framework or parent component, in the default namespace. A good example of this is and other subcomponents of the parent mxml component you might be extending.

To fix this you should modify the mxml tag and namespaces so that the default namespace is the same as the current package. (As in the first example)

Upvotes: 1

Mauricio Gracia Gutierrez
Mauricio Gracia Gutierrez

Reputation: 10844

In my case the problem was solved by changing the SDK version of the Flex Compiler to 4.5

You can try with different SDK versions, until you get your component to compile or until the error changes to something related to a theme related error.

After changin this I got an error related to a propertie that is not supported by the current theme, so I open the component in design view and in the Properties View selected the Appearance tab and changed the theme from SPARK to HALO

Hope this is usefull for somebody else

Upvotes: 1

himanshupareek66
himanshupareek66

Reputation: 846

Might be I am very late to answer this question, but this might be because the package name which is associating with your class is not the exact and appropriate.

Upvotes: 0

JeffryHouser
JeffryHouser

Reputation: 39408

Usually errors like this means you have two components named similarly and the compiler couldn't tell which one you wanted to use.

Do you have another component with the same, even in a different package? Or do you have a variable in your component the same name as the component? Be sure to check your SWCs and/or Library projects.

I'm assuming this is a compile time error; is that correct?

Upvotes: 1

Robusto
Robusto

Reputation: 31883

Try the following:

  • Right-click on your project in the Package Explorer.
  • Select "Properties" in the pop-up menu (last item).
  • Click "Flex Library Build Path"
  • Click the "Classes" tab

Try to find the name of your new component in there. If you do, see if it is checked or not. If it is not, check it. That should solve the problem right there, but you may have to clean and (sometimes) quit FB4 and relaunch.

Upvotes: 3

Related Questions