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
Posted by: diamondtearz | September 24, 2008 2:00 PM
Posted by: Thijs | October 9, 2008 9:16 AM
Posted by: mizti | October 16, 2008 7:36 AM
Posted by: jzuo | December 5, 2008 3:09 AM
Posted by: Thomas B. | December 17, 2008 3:22 PM
Posted by: ralph | January 21, 2009 12:29 PM
Posted by: Arnab Jyoti Sarkar | January 28, 2009 3:45 AM
Posted by: Noah | February 12, 2009 10:46 AM
Posted by: Brian | February 21, 2009 1:17 PM
Posted by: Jesse Bethke | February 27, 2009 5:47 PM
Posted by: Katy | April 10, 2009 9:27 PM
Posted by: Gerry | April 21, 2009 1:19 PM
Posted by: Adrian | May 11, 2009 1:58 AM
Posted by: Richard N. Sparrow | May 17, 2009 4:06 PM
Posted by: Dan Moore | June 5, 2009 8:11 PM
Posted by: xtedx | July 13, 2009 6:42 AM
Good post!
It's kind of obvious when you think about it -- the give away is the lower case on which means it is referring to an attribute of an object rather than the name of a class, so "obviously", the attribute has to be referenced out of the same namespace as its object.
Thanks again
Posted by: Sean Fisher | July 22, 2009 4:44 PM
Posted by: Mark Lord | December 2, 2009 7:34 PM
Posted by: Toni | January 6, 2010 9:00 AM
Posted by: zourtney | January 27, 2010 11:46 AM
Posted by: tom | March 31, 2010 5:38 AM
Posted by: Lisa | May 31, 2010 1:23 PM
Posted by: Sanjeev | June 14, 2010 1:23 PM
Posted by: pradeep | July 20, 2010 7:04 AM
Posted by: velu | August 2, 2010 7:32 AM
Posted by: Anonymous | October 25, 2010 6:10 AM
Posted by: Vincent | December 20, 2010 5:52 AM
Posted by: karthik | April 20, 2011 2:25 AM
Posted by: Kiran Karra | October 23, 2011 1:27 AM