CodeCanyon

Line break problem

509 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 3-4 years
  • Bought between 1 and 9 items
  • Portugal
plusquare says

Hi guys!

I’m having a problem in a as3 code here for which i could use a little help, it might be a stupid thing but it’s driving me nuts in the last half hour :D

I have a text field in which i import text from a xml file enclosed with cdata tags. the text loads perfectly and i use an external stylesheet for the text formatting, runs well, the only problem is that line breaks and pharagraphs don’t work as i wanted…

imagine i have 4 line breaks and 2 pharagraphs in the same position and it counts onyl by one break. ANyone got a clue why? do I have to set something in the stylesheet for the p and br?

Thanks for any help :)

509 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 3-4 years
  • Bought between 1 and 9 items
  • Portugal
plusquare says
this.condenseWhite=true;
this.styleSheet=sheet;
this.htmlText=txtString;

this.wordWrap=wordwrap;
this.antiAliasType="advanced";
this.embedFonts=true;
this.selectable=selectableBool;
this.mouseWheelEnabled=false;
this.multiline = multiline;

this.autoSize=TextFieldAutoSize.LEFT;

var textHeight:Number=this.height;
this.autoSize=TextFieldAutoSize.NONE;
this.height=Number(textHeight)+Number(this.getTextFormat().leading);

this what I’m using for the text field… (this is a text field instance)

1663 posts
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Bought between 1 and 9 items
  • Exclusive Author
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
Tean says

Hi VisualWorks!

How does you xml text and stylesheet looks?

509 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 3-4 years
  • Bought between 1 and 9 items
  • Portugal
plusquare says
<description><![CDATA[<newsTitles>Since yesterday no one knows how to write!</newsTitles>
        <p></p><p></p><br></br><br></br><br></br><newsText><p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet.</p> </newsText>]]></description>

this is the xml node for the text…

the style sheet has this

newsTitles {
    font-family:BentonSans-Thin;
    font-size: 26;
    color: #ffffff;
    text-align: left;    
}
newsText {
    font-family:BentonSans;
    font-size: 13;
    color: #cccccc;
    text-align: justify;    
}

i tried almost anything :s

1663 posts
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Bought between 1 and 9 items
  • Exclusive Author
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
Tean says

Not sure, but I have tried your example and got multiple linebreaks between newsTitles and newsText.

509 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 3-4 years
  • Bought between 1 and 9 items
  • Portugal
plusquare says

Thanks Tean, but mine appears llike this :

:s Any guesses?

1663 posts
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Bought between 1 and 9 items
  • Exclusive Author
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
Tean says

I will send you the example i made later when i get home again.

509 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 3-4 years
  • Bought between 1 and 9 items
  • Portugal
plusquare says

I will send you the example i made later when i get home again.

I’d appreciate thanks :)

by
by
by
by
by