all groups > flash data integration > august 2006 >
You're in the

flash data integration

group:

Unwanted character codes (& etc) from XML displaying in Flash


Unwanted character codes (& etc) from XML displaying in Flash maija_g
8/27/2006 11:44:31 PM
flash data integration: I have a static, UTF-8 encoded XML document that gets loaded by a custom movie
clip class into an array and then items from the array are read and displayed
in a dynamic text field that is attached to the movie clip, depending on which
one is rolled over. Everything works perfectly except that an ampersand
displays as & apostrophes display as ' and quotes display as ', even
if I use the special character inside the XML. Higher level character codes
actually display properly, so character codes for circle shaped bullets,
registered trade mark symbol, Greek characters, etc, work! But a blessed
ampersand does not.

Setting the dynamic text field to either read as HTML or not read as HTML
makes no difference.

Using CDATA tags in the XML makes no difference. In fact, when I use CDATA
tags and enclose text containing a special character code, Flash goes the extra
step of converting the ampersand in the special character code to &!! So '
becomes ".

Using & just gets converted to &. So Flash is parsing the &#38 to an
ampersand, which it then converts to &. WHY? And how do I stop it?

I found the function below to clean out the unwanted characters, and it works,
but it seems a ridulous length to go to. And I probably have to extend it to
accomodate whatever other characters don't work in Flash, but I don't know what
those might be until I encounter them. And the whole point to using the XML was
so that someone without Flash could update the file.

Thanks for any help.

private function cleanTextFunc(txt):String {
txt = txt.toString();
txt = txt.split("'").join("'");
txt = txt.split("&").join("&");
txt = txt.split(""").join("\"");
return txt;
}
Re: Unwanted character codes (& etc) from XML displaying in Flash The Feldkircher
8/28/2006 12:00:00 AM
Yo Dude

Need to see more code for a clearer understanding of your structure,
especially the XML Parser and XML file.

So far I can't repeat your problem, I get clear txt with no character code
errors.

Later
Re: Unwanted character codes (& etc) from XML displaying in Flash -->dan mode
8/28/2006 9:52:21 AM
Have a look at this:
http://www.smithmediafusion.com/blog/?p=144


--

Dan Mode
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com
*Must Read* http://www.smithmediafusion.com/blog


[quoted text, click to view]

Re: Unwanted character codes (& etc) from XML displaying in Flash maija_g
8/28/2006 2:13:55 PM
After getting a few hours of sleep I looked at it again and realized I was
parsing firstChild instead of firstChild.nodeValue. *smacks forehead* durrrr

So now it comes through clean without any mucking around at all! Thanks anyway!
Re: Unwanted character codes (& etc) from XML displaying in Flash maija_g
8/28/2006 4:25:20 PM
AddThis Social Bookmark Button