5 Replies Latest reply on Jun 14, 2011 11:20 PM by relaxatraja

    Flash and CDATA

    pantelis224466

      Hi there.
      I load a text from an xml file which has a code like this:

      <?xml version="1.0" encoding="utf-8"?><xml>
      <content>
      <description><![CDATA[<br><br>
      <font color="#FFFFFF" size="20" style="font-family:Calibri">PROFILE</font><br><br><p align="justify"><font color="#FFFFFF"  size="15"><i>My company in italics  </i></font>
      <font color="#ffffff" style="font-family:Calibri" size="15"><b>my Company in bold</b></font>
      <br><br>
      <font color="#FFFFFF"  size="15" style="font-family:Calibri"my Company name with another font family </font><br><br>
      link<br><br></p>
      <br><br>
      <font color="#FFFFFF" size="15">
      <p align='right'><font color="#FFFFFF" size="20">mailto link</font></p></font>]]></description>
      </content>
      </xml>
      
      
      
      
      
      
      
      
      

       

      When i change the font size and font color i get the result i want.

       

      But when i try to change the font-family, or to make a part of text in italics or bold i fail to get what i want.

       

       

      I also tried this:

      <font style="font-style:italic">my text</font>


      with no success

       

      What should i do?

       

      Thank you in advance

        • 1. Re: Flash and CDATA
          relaxatraja Level 5

          for italics directly use <i></i> tag.

          • 2. Re: Flash and CDATA
            pantelis224466 Level 1

            When i write:

             

            <content>
            <description><![CDATA[<i>My text</i>]]></description>
            </content>

            then this part of text that is inside <i></i> tags does not appear.

            • 3. Re: Flash and CDATA
              relaxatraja Level 5

              txt.htmlText=str;

               

              you assigning with htmlText right? Also check whether you embeded  all type of fonts bold, italic? otherwise it won't come.

              • 4. Re: Flash and CDATA
                pantelis224466 Level 1

                function loadContentText () {
                    var cont:XML = new XML ();
                    cont.ignoreWhite = true;
                    cont.onLoad = function (success) {
                        if (success) {
                            var root:XMLNode = this.firstChild;
                            fullText = root.childNodes[0].childNodes[0].childNodes[0].nodeValue;

                            contentTextBox._visible = true;
                            ZigoEngine.doTween (contentTextBox,'_alpha',100,2,"easeOutExpo",0);
                            contentTextBox.contentText.txt.htmlText = fullText;
                            contentTextBox.contentText.txt.autoSize = true;

                            if (contentTextBox._height > contentTextArea.back._height) {
                                startFloat ();
                            }
                        }
                    };
                    cont.load ("html_content_page_xml-el/contents.xml");
                }

                 

                This is the code its used in .fla and it takes the html data from an xml file. The code at the xml file is like the code at my first post.

                Where:

                contentTextBox is the instance name of contentText movieclip

                contentText is the instance name of the textbox movieclip

                txt is the instance name of the textbox

                (Its like you have a textbox with instance name txt, then convert it to movieclip with instance name contentText and then convert it again to movieclip with instance name contentTextBox).

                 

                At the textbox i have chosen my font (Calibri) and at character embeding i have chosen all. I do not understand how to embed the Calibri italics for example, as font face is italics and font style is italics. I cannot find out where or how to include calibri italics font as a font and not as style.

                 

                What am i doing wrong??

                • 5. Re: Flash and CDATA
                  relaxatraja Level 5

                  Within your fla create three textboxes and name it as _txt, for each textboxes just embed the calibri font with bold, with italic, with both. Now its embedded in your flash file and now try your code, it works?