all groups > flash (macromedia) > december 2003 >
You're in the

flash (macromedia)

group:

HTML-Field: Spaces get lost


HTML-Field: Spaces get lost Frank Thorstens
12/14/2003 9:56:16 PM
flash (macromedia):
Hi,

Is there any solution known to the problem that in html textfields spaces
between html tags get lost?

<i>Hello</i> <b>World</b>

results in: HelloWorld.

I generate the texts automically so i cannot easily insert &nbsp oder not.
if a would insert nsbp after every tag then sometimes there would appears
two spaces :-/

Who can help me?

bye,
Frank

Re: HTML-Field: Spaces get lost Laiverd.COM
12/14/2003 10:59:22 PM
Try using this prototype function:

String.prototype.replace = function(str, newStr) {
var s = this;
var i = s.indexOf(str, 0);
newStr = ((eval(newStr) == undefined) ? newStr : ((typeof (eval(newStr)) ==
"function") ? eval(newStr)() : eval(newStr)));
if (i < 0) {
return this;
}
return s.split("").splice(0, i).join("") + newStr + s.split("").splice(i +
str.length, s.length - str.length).join("").replace(str, newStr);
};

TO be used like this:
myvar = "<i>Hello</i> <b>World</b> <i>is</i> a <b>standard</b> <i>text</i>";
trace(myvar);
myvar = myvar.replace("> <",">&nbsp;<");
trace(myvar);
txt.htmlText = myvar;

John

--
----------------------------------------------------------------------------
-----------------------------------------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
----------------------------------------------------------------------------
-----------------------------------------
TUTORIALS
Flash & PHP Emailform:
http://home.hccnet.nl/john.mulder/flash/tutorials/flash_php_mailform.zip
----------------------------------------------------------------------------
-----------------------------------------
[quoted text, click to view]

AddThis Social Bookmark Button