3 Replies Latest reply on Jan 12, 2009 1:21 PM by mchtower

    Button Itemrenderer Question

    mchtower
      I'm having trouble setting the fontFamily property of a button contained in an itemrenderer. The font in question is embedded via a css file in my main application file like so: <mx:Style source="assets/default.css" />.

      Then, in my itemrenderer I try to set the font to a font embedded in default.css but the font is not being used when I run the app. Can someone tell me what am I doing wrong? Here is the itemrenderer code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Button label="{data.text}" labelPlacement="right" color="#000000" fillColors="{data.color}" themeColor="#000000" xmlns:mx=" http://www.adobe.com/2006/mxml" fontSize="12" fontFamily="Childish Alpha" horizontalGap="0" textRollOverColor="#000000" icon="@Embed('assets/images/paw.gif')" overIcon="@Embed('assets/images/bear.gif')" downIcon="@Embed('assets/images/smile.gif')" selectedDownIcon="@Embed('assets/images/smile.gif')" selectedUpIcon="@Embed('assets/images/smile.gif')"/>
        • 1. Re: Button Itemrenderer Question
          Level 7

          "mchtower" <webforumsuser@macromedia.com> wrote in message
          news:gkfq37$ott$1@forums.macromedia.com...
          > I'm having trouble setting the fontFamily property of a button contained
          > in an
          > itemrenderer. The font in question is embedded via a css file in my main
          > application file like so: <mx:Style source="assets/default.css" />.
          >
          > Then, in my itemrenderer I try to set the font to a font embedded in
          > default.css but the font is not being used when I run the app. Can someone
          > tell
          > me what am I doing wrong? Here is the itemrenderer code:

          The button control uses the bold version of the font.


          • 2. Re: Button Itemrenderer Question
            Gregory Lafrance Level 6
            Most Flex controls use the regular (non-bold, non-italic) font, but some controls, like the Button control, use the bold font by default.

            So embed the bold font and have the font family refer to that embedded bold font.
            • 3. Re: Button Itemrenderer Question
              mchtower Level 1
              Amy and Greg,

              Thanks for your replies. I don't have the bold version of the font so I set the fontWeight to normal on the itemrenderer's button and that took care of it.