January 25, 2007

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>

Tags: as3 error flex2

September 28, 2006

AutoComplete Text Input

Adobe's Flex Team has released their first component on the Flex Exchange. It is an AutoComplete Text Input. Cool stuff.

Tags: components flex2

September 28, 2006

Fonts in Flex 2

While working on a transition recently in Flex 2 I had some issues with button text not fading along with the rest of the components. Digging into the documentation I ran across this nugget of information:

The Dissolve, Fade, and Rotate effects only work with text rendered using an embedded font. If you apply these effects to a control that uses a system font, nothing happens to the text.

Maybe this is just known but it was a surprise to me. There are other helpful font tidbits on the Using embedded fonts with effects page.

Tags: flex2 fonts