PDA

Volledige versie bekijken : Prototype voor html replace


ScriptSuite
%Europe/Berlin %894 %2005, 22:28
<font face='Arial'><b>NIEUWS</b></font>

==>

<font face='Arial'><b>NIEUWS</b></font>

Is er een standaard functie voor deze omzetting binnen flash?
Bij voorbaat dank.

Roenes
%Europe/Berlin %899 %2005, 22:34
escape en unescape dacht ik :)

Dit is trouwens gewoon te vinden in de help van flash hoor :)

raidho
%Europe/Berlin %953 %2005, 23:52
zoiets zal t doen:

String.prototype.htmlEncode = function() {
s = this;
a = s.split("&"); s = a.join("&amp;");
a = s.split("'"); s = a.join("&apos;");
a = s.split(" "); s = a.join("&nbsp;");
a = s.split("<"); s = a.join("&lt;");
a = s.split(">"); s = a.join("&gt;");
a = s.split('"'); s = a.join("&quot;");
return s;
}

String.prototype.htmlUnencode = function() {
s = this;
a = s.split("&amp;"); s = a.join("&");
a = s.split("&apos;"); s = a.join("'");
a = s.split("&nbsp;"); s = a.join(" ");
a = s.split("&lt;"); s = a.join("<");
a = s.split("&gt;"); s = a.join(">");
a = s.split("&quot;"); s = a.join('"');
return s;
}

str = "<font face='Arial'><b>NIEUWS</b></font>"
trace (str.htmlEncode())
str2 = "&lt;font&nbsp;face='Arial'&gt;&lt;b&gt;NIEUWS&lt;/b&gt;&lt;/font&gt;"
trace (str2.htmlUnencode())

mateo)
%Europe/Berlin %967 %2005, 00:12
ik weet niet wat je van plan bent, maar als je deze string van buiten flash inlaadt en toewijst aan een html tekstveld, hoef je niks te converteren.