Ole Media
Ole Media

Reputation: 1642

AS3 XML and Line Spacing Problem

Background: I'm building this photo gallery in AS3, when user clicks a thumbnail is displays text gathered from an XML file.

Problem Description: Everything runs wonderful on my local machine, but when I upload the files to the server and preview the site from the server, the line spacing on the description text is way different than when I preview the site local.

Below see two images so you can see the difference

Correct one (Preview from Local Machine)

correct Spacing http://www.olemedia.net/lineSpacing1.jpg

Incorrect One (From the Browser)

incorrect Spacing http://www.olemedia.net/lineSpacing2.jpg

Solution: Any suggestions?

Upvotes: 1

Views: 3328

Answers (3)

Frank
Frank

Reputation:

It is indeed a line break issue that depends on what platform you're on, or rather. how the xml document was saved. Line breaks on windows are \r\n (Carriage Return + Line Feed). if I recall correctly. Flash player interprets both as a newline. I usually do something like this:

var text:String = xml.whatever.text().split("\r").join("");

That will get rid of all the \r's (if they're there) and leave only \n's.

Upvotes: 2

Ole Media
Ole Media

Reputation: 1642

I found the solution. Is a bug with Flash CS4 (mac and windows).

I place my flash file to a Linux server and also to a windows server. Definitely windows server was the problem. I'm not sure why but it is. I'm working from mac, and possibly this effect also on the type of server you publish you swf files.

Thanks everybody, much appreciate your time and dedication.

Upvotes: 0

Chad Birch
Chad Birch

Reputation: 74558

Your images don't show up (I think there's a minimum reputation required to post images), but based on the description I'm going to guess that your local machine is windows and the server is unix. It's probably a problem with line-endings being \r\n instead of \n, most editors can do this conversion for you, or there are various tools to convert.

If this isn't right, link to the images so that we can see what's happening.

Upvotes: 0

Related Questions