2 Replies Latest reply on Oct 10, 2008 2:24 PM by voxL

    Tricky CSS_XML Problem

    voxL Level 1
      I am having trouble fading XML-based text formatted w/CSS.
      What I'm attempting to do is use an internal CSS sheet to format external XML text.
      I have it working except for the fontWeight property. When I assign
      style.fontWeight = "bold",
      the text doesn't become bold. It does work if the font is not embedded, but then I can't control the transparency, which I need to do. When the font is embedded, all the other properties of a style are obeyed except the fontWeight.

      As a workaround, I tried dynamically adding a TextField, but obtained the same results, except when textField.embedFonts = true, the TextField doesn't accept the xml text and is empty.

      As another workaround, I tried to apply an external CSS file to the text, but I couldn't figure it out in AS3. I think its a timing issue related to when the xml and css load, but even if I delay populating the textField, when I apply the external css, the textField is empty.

      I also tried assigning the font using the CSS (FontFamily), but the TextFields which exist on the stage become empty.

      I've posted the files here. Any suggestions will be appreciated.
      Thanks much.
        • 1. Re: Tricky CSS_XML Problem
          Level 7
          voxL,

          > It does work if the font is not embedded, but then I can't
          > control the transparency, which I need to do. When the
          > font is embedded, all the other properties of a style are
          > obeyed except the fontWeight.

          You'll need to embed both the normal version of the font (which it
          sounds like you've done) and also the bold version of the font. In other
          words, two font symbols in your Library ... or, two stand-in text fields --
          they can even be off the Stage -- in which the Property inspector's Embed
          button includes the font outlines for bold and nonbold.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Tricky CSS_XML Problem
            voxL Level 1
            Thanks a lot.
            Works like a charm!!!
            As it turns out, that was also the problem with the external CSS - when I changed the Font family to match the embedded font, it works as it should.
            One modification of your solution - I didn't need to add 2 font symbols to the library. By checking bold and italic in the font symbol properties, these versions of the font are also available. I tested to be sure it works that way.
            Thanks again - way too many hours on these trivial details...