Flash Whitespace
- Started
- Last post
- 14 Responses
- versa
anyone ever have those unwanted extra white spaces showup in imported htmlText, inside a dynamic text field..
i keep getting extra, one spaces at the beginning of some of my paragraph lines, and can't figure out how to get rid of them...
i've read about several workarounds, but they don't seem to work - i've also tried the "textField.condenseWhite" trick , but to no avail
help would be super appreciated
- versa0
oh, and the text is being brought in from just a .txt - not XML
thanks
- partlyhuman0
sorry this is kind of rude, but i'm replying without actually trying it... but...
i have had problems with setting a property on an object and it just not taking effect... but it worked when i tried applying it to the prototype (should apply it to all objects of the same type you create)... so why not try (at the top of frame 1 actions)
TextField.prototype.condenseWhit... = true;
lemme know if this has any effect..
- jkosoy0
Hm. Tough one cuz I've never dealt with it.
One thing that MIGHT work is to split the text every time it senses more than 2 spaces, and then rejoin it immediately. In that way, you'll get rid of anything that has more than a single space in the document.
assuming your dynamic text is loaded into variable text_to_split:
text_to_split = text_to_split.split(" ").join("");
myTextfield.htmlText = text_to_split;
- versa0
thanks guys...trying those suggestions now
anybody else have this problem
?
- jkosoy0
I got it.
Make a new Flash file with a dynamic text field named myTextField.
On the first frame, put this code:
-----------
text_to_print = " sdafhksadfljkafsdlsfa kjldsjaflksdf kljsadfjlk;safdj jklsdfjkl;safdjl;kfsad";text_to_split = text_to_print.split(" ").join("");
if(text_to_split.substr(0,1) == " ")
{
text_to_split = text_to_split.slice(1,text_to_sp...
}myTextField.htmlText = text_to_split;
-----------
That should automatically remove any double-spaces (or more) in your text.
- JamesEngage0
I've had that a couple of times... where it is text that has rarely changed... I cheated and stuck a BR in... otherwise I've had to live with it...
Might go on a hunt for a solution!
- jkosoy0
see my above post. :)
you can replace the text_to_print variable with whatever you want, or just implement it with your own variable name.
I can put the FLA online if you'd like...as soon as my web server goes up again. :(
- JamesEngage0
I don't think it is double spaces though... I think it thinks of the space as a 'character' although a seperate one from the word before and after... now if that 'character' doesn't fit it wrapson a line, it wraps it... so you end with the 'character' at the start of the next line...
Double spaces would be easy to solve... just don't do them :)
- jkosoy0
Hm.
Well that changes everything. :)
There's got to be a tech note out there somewhere on how Flash reads that character. There's no reason that it should treat whitespace as anything other than a space character.
- versa0
thats a nice approach, but unfortunately, i don't really have double spaces,i don't think...
somehow my text is getting wrapped with an extra space that actually isn't in the .txtso....still not sure, but thanks for the suggestions...i'll play with it
- JamesEngage0
I think... but I'm not sure, that it happens with HTML text rather than just normal? Might be wrong though?
- jkosoy0
hmph. well, at least i tried. :)
is your text document spaced out or is it just wrapped really long? try removing any spacing.
after that, i'm tapped for ideas. maybe the easiest solution might be to convert to a simple xml document and then the white space will remove?
- versa0
man i sure don't want to put "+"s between that whole damn paragraph just to make it work!... LOL
- jkosoy0
:)
%250a - line break
%250d - carriage returnI think those are the correct characters...try those in a single line text field.