Could not resolve * to a component implementation.
Often when refactoring code I'll extract ActionScript code out of an MXML file into an ActionScript based superclass to get a cleaner separation between logic and the view. In doing so I sometimes forget to update MXML variable declrations, leading to the confusing error:
Could not resolve <mx:states> to a component implementation.
In this case my MXML class extends another custom class and looks like:
<?xml version="1.0" encoding="utf-8"?> <example:CustomCanvas xmlns:example="com.example.*" xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:states> <mx:State name="default"/> <mx:State name="custom"/> </mx:states> </example:CustomCanvas>
The issue is that the "mx" namespace doesn't match the root component's namespace so the MXML compiler gets confused about it being a property versus a child component. The simple fix is to just change the namespace on the property to match the root component's namespace like this:
<?xml version="1.0" encoding="utf-8"?> <example:CustomCanvas xmlns:example="com.example.*" xmlns:mx="http://www.adobe.com/2006/mxml"> <example:states> <mx:State name="default"/> <mx:State name="custom"/> </example:states> </example:CustomCanvas>
Comments
Posted by: S2 | March 16, 2007 4:28 PM
Posted by: san | August 17, 2007 8:29 AM
Posted by: Jorge Rodrigues silva | January 17, 2008 12:46 PM
-Shailesh
Posted by: Shailesh Mangal | February 5, 2008 7:33 PM
Posted by: kris | February 26, 2008 1:16 PM
Posted by: joe beuckman | May 15, 2008 1:31 PM
Posted by: Marc H. | July 20, 2008 8:17 AM