Groups | Blog | Home
all groups > flash actionscript > october 2006 >

flash actionscript : xml formatting issues when reading into dynamic text field


stephan.k
10/10/2006 9:17:39 PM
Dear List

I am reading text from an external xml file which at runtime is placed into
dynamic text fields. So far so good. Everything works. The client is now
asking for italic and bold fonts ([B][/B], [I][/I]), and I realize that the
special characters like apostrophes and such are not displyed correctly. ('
nor '). What is the magic trick to make those two things work?

Thanks for any leads

All best

Stephan
LuigiL
10/10/2006 9:22:00 PM
stephan.k
10/10/2006 9:43:39 PM
thanks LuigiL. i've tried it but I think my problem lies somewhere else.

my xml file:
---------------
<?xml version="1.0"?>
<yellowstickers>
<set type="story">
<item title="The TEST"><![CDATA[ [B]test bold[/B] normal text [I]italic
text[/I] ]]></item>
</set>
...
</yellowstickers>
------------

and in flash I have an textfield prepared, that has html set to on. and I'm
also embedding all the outlines. Next to it I have two additional text fields
with the bold and the italic outlines placed on the timeline, also with the
embedded fonts.

then the actionscript:

var yt:String = getTheExternalXMLString()...

yellowstickerMC.txtMC.html = true;
yellowstickerMC.txtMC.htmlText = yt;

-------------

and flash spits out the following in the text field:
[B]test bold[/B] normal text [I]italic text[/I]


---------

??? Thanks :)
LuigiL
10/10/2006 9:46:39 PM
stephan.k
10/10/2006 9:54:04 PM
I use onLoad. the text comes through, its just that the html within the Cdata
tag is not being recognized as html, but just as plain text. the xml file
content does come through and is being displayed, so on that end things are
working,
LuigiL
10/10/2006 9:57:37 PM
stephan.k
10/10/2006 10:14:28 PM
I got it... Thanks LuigiL for helping me debugging. Now I'll have a reference
for this issue. Here's the solution:

Use firstChild.nodeValue instead of childNodes.


String(YSXML.firstChild.childNodes[typeNum].childNodes[_item].firstChild.nodeVal
ue);

here's the adobe link on the subject:
http://livedocs.macromedia.com/flash/8/main/00002899.html

Cheers!

stephan

LuigiL
10/10/2006 10:18:26 PM
AddThis Social Bookmark Button