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>