Skip to main content
grendizerus
Known Participant
July 14, 2008
Question

Too many line breaks in imported HTML file

  • July 14, 2008
  • 3 replies
  • 824 views
Hi all,

I imported an external HTML file in my stage.

The problem is there are too many line breaks in the text that appear.

For example, my HTML code would be like : <p>Click here <a href="page.html">page</a></p>

And the result on the stage would be:

Click here
Page

So there is a line break after "click here" although there should not!

I don't know how to remove these line breaks

Here is the ActionScript 3 code:

var loader:URLLoader;
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, xmlLoaded);
var request:URLRequest = new URLRequest("home/index.html");
loader.load(request);
function xmlLoaded(event:Event):void {
zonedetexte.htmlText = new XML(loader.data);
}

thanks a see you,

David
This topic has been closed for replies.

3 replies

grendizerus
Known Participant
July 15, 2008
Thanks a lot for the help.

Indeed, this code was too XML oriented.
I just changed the line : "zonedetexte.htmlText = new XML(loader.data);" and replaced it by "zonedetexte.htmlText = loader.data;"

And I got much better results.
But after that, I was still experiencing a lot of unwanted line breaks.
I found out a lot of line breaks in Flash were the results of line breaks in the XHTML code!!
For example : if the tag <body> is followed by a line break and then by a tag <div>, you won't see a line break in internet explorer, but you will see one in the Flash stage !!

See you,

David
robdillon
Participating Frequently
July 14, 2008
My guess is that you are loading a text file and using an XML method to accomplish this. I'm guessing that Flash is inserting returns whenever it finds an tag pair. In your example the return happens when the <a... and </a> are found.
Inspiring
July 14, 2008
Hi grendizerus,

Things I'd check are
the width of the field on the stage
the CSS (if any) attached to the field
the condenseWhite property of the field in combination with linebreaks in the HTML source.

hth,
manno