1 Reply Latest reply on Apr 30, 2008 9:01 AM by Rothrock

    Dynamic text with css issues

    Clockwork_Killa
      Im trying to format some externally loaded text with CSS. I have a dynamic textbox on stage, with the instance name "myText1", the content Im loading is coming from an XML file called "main.xml" and Im trying to format it with a stylesheet called "flash.css".
      The problem Im getting is one of two. The first problem is, that unless I paste the code directly onto the frame from another movie that Im working on with css (which works I might add), it doesnt format the text at all, and it just literally pastes the XML into the textbox all in one line, tags and all. Ive tried typing out the code word for word, but it does the same thing unless I paste it in. Its really weird and extremely frustrating!
      The second problem is, once ive actually got it to read the XML properly, it will format my text content, with the exception of the Font-family. If i put a font-family property in my CSS it doesnt display the text, if I leave the font-family out, it works fine for color, size, weight etc, but font-family just causes it to show a blank box. Again this is really weird and its drinving me nuts!
      Any ideas would be greatly appreciated.

      My Xml looks like this:

      <content>
      <title>Test</title>
      <article>Test Article 1 yeeeeah, this is definitely a test article, if it wasnt it wouldnt be called test now would it!</article>
      </content>

      <content>
      <title>Test2</title>
      <article>Here is another test for the main area</article>
      </content>

      <content>
      <title>Test 6</title>
      <article>This is a test article</article>
      </content>

      My CSS looks like this:

      title{
      color:#FF0000;
      font-size:20;
      font-weight:bold;
      letter-spacing:-1px;
      text-decoration:none;
      }

      article{
      font-family:"Arial, Helvetica, sans-serif";
      color:#000000;
      font-size:12;
      font-weight:normal;
      letter-spacing:;
      text-decoration:none;
      }

      And this is the code Im using to load and format the XML:
        • 1. Re: Dynamic text with css issues
          Rothrock Level 5
          Well I would start with myText1.htmlText=myContent. Probably not the main issue, but it won't hurt.

          Next make sure that you are saving the CSS and XML files as UTF-8. Flash really likes those formats and plays much better with them. Again probably not the problem, but it won't hurt.

          Finally I'm not sure what to tell you. I just tried this out and it worked just fine for me. I am a little surprised because I had neve thought of using XML and HTML coding intermixed just like that. I was surprised it worked. Other things I could think of might be that the XML is loading before the style sheet and that could cause problems. So you might want to use a myStyle.onLoad event handler to make sure it is loaded before you load the XML.