Skip to main content
Known Participant
October 10, 2006
Question

xml formatting issues when reading into dynamic text field

  • October 10, 2006
  • 4 replies
  • 319 views
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 &apos;). What is the magic trick to make those two things work?

Thanks for any leads

All best

Stephan
This topic has been closed for replies.

4 replies

stephan_kAuthor
Known Participant
October 10, 2006
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.nodeValue);

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

Cheers!

stephan
Inspiring
October 10, 2006
There you go. And I learned to ask for the xml parsing code too... I'm off to bed!
stephan_kAuthor
Known Participant
October 10, 2006
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,
Inspiring
October 10, 2006
Try bypassing the getTheExternalXMLString() method and put in the html part directly in the text field.
stephan_kAuthor
Known Participant
October 10, 2006
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 :)
Inspiring
October 10, 2006
Are you using the onData event for your xml-object? If so, that should be the onLoad event otherwise the xml won't get parsed.
Inspiring
October 10, 2006
You have to embed the font outlines - and special characters - for italic and bold too.