View Full Version : extra returns with dynamic text
smacklemore
10-23-2003, 01:48 PM
Hi everyone,
Although I've searched here for a while, this is my first post to this forum.
My problem is that I have dynamic text I'm loading from a text file and locally it looks fine but when I uploaded it I now have two lines per return.
I realize I could use <br> and make it all one line, but I'm afraid this would be too much for my client to handle when updating her site.
Any ideas on how to fix this? Also, why doesn't this happen on the local version?
Oh, and I'm using MX.
farafiro
10-24-2003, 11:23 AM
smacklemore
welcome to the forums
donno but try thismyTextField.wordWrap = false
CyanBlue
10-24-2003, 11:41 AM
I once had that problem... I don't know how to fix that or why that happened, but the result was somewhat varying depending on the OS and the browser... :( Some people on PC did get the result right, and some people on Mac did get it double lined... Same thing happened with the specific browsers... :(
smacklemore
10-24-2003, 04:23 PM
Thanks for the replys.
Yes, I am using a Mac (osX) so I guess that's why I'm seeing the double lines. But why not locally? Also I uploaded an earlier version as a proof to my own server and no double lines there either. I'm going to try to upload the final version to my server and see what it looks like. It might have something to do with the servers. Could that be?
Farafiro,
In the script you posted, does "myTextField" refer to the variable or the instance name of the text box? Also, what is your theory behind why this might work?
Thanks again,
smacklemore
10-24-2003, 04:32 PM
Ha! I was right... for once. Check out the two versions:
Client's Server:
http://www.sarasong.com
My Servers:
http://www.d-steam.com/clients/sara/sara.html
Does anyone have any idea what could be causing this? Everything else about them is identical. I'm stumped.
CyanBlue
10-24-2003, 04:48 PM
Yup... Double spaces at your client's site... :(
I have no clue on why it is like that... Moreover, it was pretty much random on some people who have checked it in my case... Meaning two guys who had identical OS/browser see different outputs... Beats me... :(
Colin Campbell
10-24-2003, 04:57 PM
I'm on IE 6, and windows xp, and I see that your server's one has no spaces in the recordings section, only 1 in the next section, while the other server double spaces.
smacklemore
10-24-2003, 06:40 PM
Ok. Now I know it's not just on my machine. Thanks for taking the time to check it you guys. I'm wondering if I should contact the Host and see if they have any info, but if anyone here has any clue about this please let me know.
I'm also wondering if it would help to save the txt file as Unicode. Right now I'm using TextEdit and just saving as plain text because that's always worked in the past. However, I've had situations for international clients with special characters that required saving as Unicode.
Thanks again for the feed back!
senocular
10-24-2003, 07:30 PM
Heres the deal
There are two characters for what you consider:
<-- that, a change in text from one line to the next.
You have
- \r or return or carriage return
and you have
- \n or newline
... actually, I know I have a post on this already...
=========================
\r and \n represent the characters CARRIAGE RETURN and NEWLINE (aka LINEFEED). What the slash means is that its an 'escape' character. This is a way to represent a single text character in code that would normally not function in code - new line characters being a prime example of that. Another example is the tab character, which in code looks like "\t". In terms of Flash, the \r and \n, they're pretty much the same. However, operating systems handle them differently when dealing with textfiles to determine when one line ends and a new line begins. For example:
- On UNIX, text line endings are ended with a newline (\n).
- On Windows, line endings are ended with both a carriage return AND a newline (\r\n).
- While on the Mac (OS 9 and below), they end with a single carriage return (\r).
- Whereas Mac OS X, being based on BSD, uses the unix newline (\n).
What this means for Flash is a couple of things. 1) importing formatted text from the windows platform which contains line breaks will be double spaced because Windows uses both \r and \n 2) having files coming from differing platforms means an inconsistency in the characters used in determining line breaks so if you try to remove/replace/find them, extra steps are needed to allow for that.
The character used by default by Flash is \r. \n however, is commonly used in coding when including new lines into strings. Both are interpreted as new lines in Flash, so either will work. The problem comes in Windows formatted code where there are both \r and \n characters for one new line. Some text editors like SciTE allow you to edit around this - something to look into when creating text for Flash, especially when loaded in externally.
[ the rest of the post is irrelevant]
===========================
smacklemore
10-24-2003, 07:46 PM
Ok, thanks for the detailed post. Let me see if I understand.
I think you're saying that somehow my text file is being interpreted somewhere along the way as Windows based, and that is why it's putting in both /r and /n.
Does that mean my client's server is Windows platform and mine is not? Because, like I said, I'm using Mac OSX's TextEdit to create the text files. Does that even matter?
I guess my question is, is it completely up to how the server interprets the file, or do I have any control?
Sorry if I should have gotten that from your previous post. =)
senocular
10-24-2003, 08:27 PM
Yeah, actually the fact that you're doing it on a Mac doesnt make sense unless somewhere along the line its being interpreted and formatted to have \r\n line breaks instead of just \n
If the clients server is Windows, it shouldnt effect the file's contents unless opened and edited and resaved in an editor conforming to windows newline handling... at least it shouldnt... I wouldnt think... though Im sensing a small bit of hesitation in the back of my mind saying that, so if someone gets on here and tells me Im wrong, Ill believe it. Still, I dont think the server would change the file in that way.
CyanBlue
10-24-2003, 08:45 PM
I could be wrong here... ;)
I think what senocular said earlier is true (as always)...
But that wasn't consistant when I had that problem last time...
When I tried that last time, I've tested on Linux and Windows servers with the same text file that I have created on the Windows machine... Yet the result varied on who's viewing the page... Don't know why... Maybe I was doing something wrong at the time... :(
smacklemore
10-25-2003, 02:30 PM
Thanks everyone for your input. I'm still open to suggestions, but a friend of mine just directed me to a Flash-based Encoded Variable Generator from the book Flash MX Studio. If I can adapt that idea for my purposes I should be able to build a server side app that will interpret the text from an input field and save it to the text file.
Does anyone know of a finished version of what I just described? (Yes, I'm lazy.)
His other suggestion was to save the file as HTML and use the new Contribute for my client.
All just to get rid of some returns. Urrgghh!
lightmode
03-03-2004, 11:59 PM
I think the double spacing looks good on that site, gives the text some room to breathe. I'm a designer so what do I know- It looked intentioanl as it looked nice...
But hey listen, can I use \r or \t in the middle of a piece of Actionscripting like this:
mailVars.messageb = unescape("Dear " + name_txt.text + "," + \r\r\t "Thank you for showing an interest in...");
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.