I've got a combo-box that sits inside of a panel in Flex 3. Basically I want to fade the panel using a Fade effect in ActionScript. I can get the fade to work fine, however the label of the combo-box does not fade. I had this same issue with buttons and found that their fonts needed to be embedded. No problem. I embedded the font that I was using and the buttons' labels faded correctly. I've tried a similar approach to the combo-box, but it does not fade the selected item label.
Here is what I've done so far:
Embed code for the font at the top of my MXML in script:
[Embed("assets/trebuc.ttf", fontName="TrebuchetMS")]
public var trebuchetMSFont:Class;
In my init function
//register the font.
Font.registerFont(trebuchetMSFont);
The combobox's mxml:
<mx:ComboBox id="FilterFields" styleName="FilterDropdown"
left="10" right="10" top="10"
fontSize="14">
<mx:itemRenderer>
<mx:Component>
<mx:Label fontSize="10" />
</mx:Component>
</mx:itemRenderer>
</mx:ComboBox>
And a style that I wrote to get the fonts applied to the combo-box:
.FilterDropdown
{
embedFonts: true;
fontFamily: TrebuchetMS;
fontWeight: normal;
fontSize: 12;
}
The reason I had to write a style instead of placing it in the "FontFamily" attribute was that the style made all the text on the combo-box the correct font where the "FontFamily" attribute only made the items in the drop-down use the correct font.
Best Answer
You can often use <mx:Dissolve> instead of <mx:Fade>, it looks nearly identical and doesn't require embedded fonts.