problems

Another success – Problem with using embedded font fixed

As reported in this post, I was having problems with using embedded font in the <mx:Linkbar> object. Have a look at the code below to see what I had to change to get it to work (changes are in bold).

Here is the snippet for font embedding from as file -

[Bindable]
[Embed(source='include/fonts/Speedline.ttf',
       fontName='GalleryFont',
       fontStyle='normal',
       fontWeight='normal',
       mimeType='application/x-font')]
// You do not use this variable directly. It exists so that
// the compiler will link in the font.
public var embeddedFont:Class;

Here is the snippet of the style sheet -

.headerLinkBar {
    fontFamily:         GalleryFont;
    fontSize:           18;
    fontWeight:         normal;
    fontStyle:          normal;
    fontThickness:      0;

    colour:             #808080;
    textRollOverColor:  #FFFFFF;
    rollOverColor:      #262626;
    selectionColor:     #262626;
    separatorColor:     #FFFFFF;
}

.headerLinkBarButton {
	fontFamily: 	GalleryFont;
	fontWeight:	normal;
	fontStyle:	normal;
}

And here is the snippet from the MXML file -

<mx:LinkBar id="headerLinkBarThumbsView"
            styleName="headerLinkBar"
            linkButtonStyleName="headerLinkBarButton">
    <mx:dataProvider>
        <mx:Array>
            <mx:String>Arrange</mx:String>
            <mx:String>Stack</mx:String>
            <mx:String>Randomise</mx:String>
            <mx:String>Back</mx:String>
        </mx:Array>
    </mx:dataProvider>
</mx:LinkBar>

It looks like specifying the style in ‘styleName’ attribute of <mx:Linkbar> element is not enough in Flex 3.2 (it used to work in Flex 2). Specifying the style for the link bar button in ‘linkButtonStyleName’ does the trick. Hopefully someone will find this useful.

Without wax,
yOOrek

Tags: , ,

Tuesday, November 25th, 2008 Flex SDK, Flex2, Flex3 8 Comments