View Full Version : TextField a lot of space in between text??
compsci
12-22-2008, 09:46 PM
Hello all,
I have a textfield which takes in some text dynamically. It works fine, however each line break is huge for some reason! WHY!
"Have a butchers here":
http://img528.imageshack.us/img528/5392/exampletextfielded2.th.jpg (http://img528.imageshack.us/my.php?image=exampletextfielded2.jpg)
Thanks for any help.
mainegate
12-22-2008, 09:54 PM
Can tell us more details..are you using components? Is this hardcoded? Have you specified any properties?
JimRowan
12-22-2008, 10:40 PM
My guess is that you're reading it in from an XML file that was probly created using notepad. Notepad inserts extra line breaks at the end of each line that you're unaware of.
compsci
12-22-2008, 10:45 PM
var usernotes:TextField = new TextField();
usernotes.defaultTextFormat = myFormat8;
usernotes.styleSheet = style;
usernotes.htmlText = 'TextTextTextTextText';
var myFont7:Font = new Font1();
var myFormat8:TextFormat = new TextFormat();
myFormat8.font = myFont8.fontName;
myFormat8.size = 12;
myFormat8.color = 0x333333;
Where usernotes is the textfield in question.
What else can I tell you? :)
compsci
12-22-2008, 10:46 PM
Notepad inserts extra line breaks at the end of each line that you're unaware of.Close enough, the text is from a html textarea that I guess will insert linebreaks once you hit carriage return. I use PHP to insert it into the DB.
JimRowan
12-22-2008, 10:51 PM
my PHP is not nearly as good as my AS3, but maybe try using your PHP file to take out some of the returns and see what happens. Like I said, I'm not great with PHP, but I think the function you want is called "trim." look that up and see what ya get.
compsci
12-22-2008, 11:16 PM
my PHP is not nearly as good as my AS3, but maybe try using your PHP file to take out some of the returns and see what happens.To be honest JimRowan, I am not even sure where the problem is coming from? Where are these extra line breaks coming from? When I view it in phpMyAdmin in my MYSQL database, I dont see lines breaks ("\n", "<br>") but it is spaced out well in the DB.
As soon as it is translated into Flash it shows huge number of spaces, which suggests Flash is the problem! Is there a way I can ignore the extra line breaks even though I don't see it?!
If I use PHP to take out line breaks how many should I take out? It can change for different text and different users might want extra spacing for some reason!!
JimRowan
12-23-2008, 02:01 AM
To be honest JimRowan, I am not even sure where the problem is coming from? Where are these extra line breaks coming from? When I view it in phpMyAdmin in my MYSQL database, I dont see lines breaks ("\n", "<br>") but it is spaced out well in the DB.
As soon as it is translated into Flash it shows huge number of spaces, which suggests Flash is the problem! Is there a way I can ignore the extra line breaks even though I don't see it?!
If I use PHP to take out line breaks how many should I take out? It can change for different text and different users might want extra spacing for some reason!!
This might be what you're looking for:
ignoreWhitespace (http://livedocs.adobe.com/flex/3/langref/XML.html#ignoreWhitespace)
if you upload as ascii from windows to linux you sometimes get this issue its almost impossible to trouble shoot as it seem so random, it comes down to new line characters being translated twice (i think) so that they double up.
The solution is save as utf8 and most importantly uploading as binary.
compsci
12-23-2008, 12:57 PM
This might be what you're looking for:
ignoreWhitespace (http://livedocs.adobe.com/flex/3/langref/XML.html#ignoreWhitespace)Awww, this didn't work on the textfield, since its not a property of the textfield class i guess.
compsci
12-23-2008, 01:02 PM
if you upload as ascii from windows to linux you sometimes get this issue its almost impossible to trouble shoot as it seem so random, it comes down to new line characters being translated twice (i think) so that they double up. The solution is save as utf8 and most importantly uploading as binary.This could be the problem. I am using a html form that sends a POST request to my server where PHP then process this. In my HTML document I have specified:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />I will see if I can change that to utf8 and see if it makes any difference. I will look for a PHP function that is the equivilant of the linux command dos2unix (http://linuxcommand.gds.tuwien.ac.at/man_pages/dos2unix1.html).
Seriously, though - I am going to great lengths for a simple problem. Should this really be happening?! It's just text from a HTML textarea into a flash Textfield! :confused:
selenger
01-11-2009, 02:25 PM
Awww, this didn't work on the textfield, since its not a property of the textfield class i guess.
But there is condenseWhite property of TextField.
how is the database storing the text and how is it uploaded into the database. You can sometimes detect the types of line breaks/spaces and split join them out. Have you tested on different flash players, I think the problem is not really flash itself as explained, I don't really do much outside of flash so I can't advise further, its a backend problem but what happens if you send the data to a new browser window.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.