Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / August 2006



Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
maija_g - 28 Aug 2006 00:44 GMT
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;
}
The Feldkircher - 28 Aug 2006 08:38 GMT
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
maija_g - 28 Aug 2006 15:13 GMT
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!
-->dan mode - 28 Aug 2006 16:52 GMT
Have a look at this:
http://www.smithmediafusion.com/blog/?p=144

Signature

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

>I have a static, UTF-8 encoded XML document that gets loaded by a custom
>movie
[quoted text clipped - 44 lines]
>  return txt;
> }
maija_g - 28 Aug 2006 17:25 GMT
Thanks, but that is the very same chunk of actionscript I quoted above, which I wanted to avoid using. I don't have to use it now that I've figured out that I wasn't reading the nodeValue.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.