Skip navigation
Xaren
Currently Being Moderated

Text-Indent with XML/Hml Text bug

Jan 29, 2009 6:20 AM

Hi, this problem has been bugging me and many students here.
I'm importing text from a .xml file, in tat file my text is formatted with HTML and an imported StyleSheet.


The problem is...

Image

The indentation shown here by the red rectangle...
I tried to remove it while using text-indent:0; in my css... didn't work..

I am really clueless righ now.
Thanks for the help.
 
Replies
  • kglad
    62,004 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 29, 2009 7:20 AM   in reply to Xaren
    i'm not sure what you're trying to do but the position of the red/purple rectangles is dependent on the way you're embedding your swfs in the html file and not dependent on a stylesheet.
     
    |
    Mark as:
  • kglad
    62,004 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 29, 2009 8:34 AM   in reply to Xaren
    are you trying to precisely position text within a textfield that also contains an image?

    if so, are you using cs4?
     
    |
    Mark as:
  • kglad
    62,004 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 29, 2009 12:57 PM   in reply to Xaren
    do you have text and images (dark red rectangle) in one textfield?

    actually, show me your code that assigns text or htmlText to your textfield and show the definition of all strings used in that assignment statement.
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 29, 2009 3:48 PM   in reply to Xaren
    regardless if the rectangle is there or not, i think you should be posting your code to move your topic along.
     
    |
    Mark as:
  • kglad
    62,004 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 29, 2009 5:41 PM   in reply to Xaren
    the problem(s) are in getXML() (especially check your parsing) and/or your external xml or text file and possibly your stylesheet.
     
    |
    Mark as:
  • kglad
    62,004 posts
    Jul 21, 2002
    Currently Being Moderated
    Jan 30, 2009 6:29 AM   in reply to Xaren
    sorry. i'm having a little trouble reading that code and stylesheet.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 26, 2009 1:40 AM   in reply to Xaren
    Hi Xaren,
    Did you ever resolve this problem?

    I have a similar one. Have loaded text into htmlText property of a textfield and it displays a one character space at the beginning of each line.

    Can't seem to find a way to remove it.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 26, 2009 5:13 AM   in reply to Xaren
    What you are seeing is a paragraph indent. The code that you show from 1/30 shows the setup of two textfields, both named contText. The problem is most likely in the original xml node that contains the text, or it may be in the stylesheet that you are using. If you show those to us, someone may be able to find the problem.
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 26, 2009 4:18 PM   in reply to Xaren
    I'm guessing that the default interpretation of the h1,h2,h3,h4 attributes may be the reason for those items being indented. There's nothing in this code that would cause any of those lines to indent.

    There is some weirdness in the way that Flash reads html text. There are many bugs. As a test, you might remove all of the h tags and replace those with p tags and see if the formatting changes. My guess is that it will.
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2010 10:16 AM   in reply to Xaren

    I had the same problem - have dynamic text fields created in Flash, load external CSS to format the text from XML file. The first line in text fields is always indented. I tried all the techniques including xml.ignoreWhitespace set to true and others. Nothing helped. When debugging the xml string in FDT it turns out there are linebreaks "\n" symbols that get inserted into my strings. Well, the only solution I was able to find is to wrap all my html tags in XML into CDATA tags.

     

    Like so:

     

    <header><![CDATA[<h3>Design</h3>]]></header>

    <text><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed velit nibh. Nullam vitae ipsum a ipsum dictum viverra. Vivamus.</p>]]></text>

     

    Watch out for spaces between the <![CDATA[ and <h3> tags and the text itself. Because if you insert one, it will look like an indent and you might spend another couple hours thinking it didn't work

     

    Hope this helps someone else as well.


     
    |
    Mark as:
  • Currently Being Moderated
    Oct 11, 2011 5:08 AM   in reply to Xaren

    Same problem here - fortunately managed to solve it by setting 2 properties of the XML class:

     

    XML.prettyIndent = 0;

    XML.prettyPrinting = false;

     

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML .html#prettyIndent

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/XML .html#prettyPrinting

     

    I guess this is a problem surfacing through implicit casting of xml objects to strings...

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points