6 Replies Latest reply on May 26, 2006 1:45 PM by Rothrock

    Real problem with dynamically applied styles on typography

    MistaRoots
      Hi everyone,

      Here's my problem :
      I have an application wich is a text viewer supported by a xml file that acts like a DB and throw data requested by the flash application. My client needed to have the possibility to write some words in italic. So since I can't put <I> tags in xml i created my own tag [em] that is spotted by the "text generator" and change the TextFormat of the words surrounded by the tag to a defined TextFormat that change the font by an italic one. Until here, there is no problem BUT there's a weird bug that happens when it comes to display the generated text. Some words in italic seems to be misplaced in the paragraph and sometimes they are placed over the previous word! I tried a lot of things but this always happens! I hope some of you have experienced the same problem and could help me to find a suitable solution.

      Here's a screenshot of a page that display a text with Italic : Screenshot
        • 1. Re: Real problem with dynamically applied styles on typography
          Rothrock Level 5
          You can't put <i> tags in XML? Why?

          What is this "text generator" you speak of? The overlap problem is most likely caused by that code. Maybe?

          Are you displaying the text in an html enabled field?
          • 2. Re: Real problem with dynamically applied styles on typography
            zupko
            You shouldn't have a problem embedding HTML inside of XML. Just parse to the levels you need, then input the text node into a dynamic text field. If you don't want to give up your method, try inputting just a plain line that is formatted with the italics. If it is still messed up, then the problems lies within the plugin, not your programming.
            • 3. Re: Real problem with dynamically applied styles on typography
              MistaRoots Level 1
              First, the main reason why I can't put <i> tags in my xml file is beacause i use a method that automatically parse the XML file and put it in an object. So this method will not make the difference between XML tags and HTML tags ...

              I have another question concerning <i> tags : how do you specify the italic font to be used in <i> ?
              • 4. Re: Real problem with dynamically applied styles on typography
                Rothrock Level 5
                I don't know if this will meet the needs of your project, but I recommend wrapping the "text" parts of your XML file in a CDATA tag. That will stop the XML parser from following down that node to what it thinks are subsequent child nodes. Something like this:

                <desc>
                <![CDATA[<p>Some text here and <i>italics here</i>. And the XML parser will leave everything inside these tags alone.]]>
                </desc>

                As for how to specify the italic font used, I'm not totally certain. I have done a little bit with Flash's implementation of CSS, but not much. Let us know what you find out!
                • 5. Re: Real problem with dynamically applied styles on typography
                  MistaRoots Level 1
                  Thanks Rothrock for the CDATA idea. I didn't know this could be done with that! But having solved this problem, i understand the real f**cking problem. Flash can be so stupid sometimes ... So in order to use the <i> tags I must set a system font because only system fonts go to italic when i got a <i> tag. Obviously, i have to put a mask over the textfield because of the scrollbar and for an unknown reason when a not embedded font is displayed below a mask it doesn't appears!!! So I'm stucked in this mud.

                  Is there a someone from Macromedia that can tell us the reason why with version 8 this thing isn't solve yet?!
                  • 6. Re: Real problem with dynamically applied styles on typography
                    Rothrock Level 5
                    You can embed fonts. You just have to also embed the italic version of the font (and bold if you plan to use it.) I haven't done much of this so I can't just give you explicit directions.

                    Actually fonts are a really complicated thing and with MM becoming Adobe I'm thinking it won't get too much easier. In fact it is likely to get seemingly more difficult. But in the end it is what probably needs to be in order to provide the user the types of control that we want. There probably are simpler ways to handle fonts, but then we wouldn't have the control that we currently do.