flashas2,XML不';内部不接受HTML?
一个简单的as2 flash应用程序。这就是读取XML文件 以下是Flash AS2:flashas2,XML不';内部不接受HTML?,xml,flash,actionscript-2,Xml,Flash,Actionscript 2,一个简单的as2 flash应用程序。这就是读取XML文件 以下是Flash AS2: function loadXML(loaded) { if (loaded) { _root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; _root.comments = this.firstChild.childNodes[0].childNodes[1].f
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("inventors.xml");
这是我的XML:
<?xml version="1.0"?>
<y>
<t>
<name>Name Here</name>
<description>Some Html or what not in here, <b>I'm BOLD</b></description>
</t>
<t>
<name>Name 2 Here</name>
<description>Some Html or what not in here</description>
</t>
<t>
<name>Name 3 Here</name>
<description>Some Html or what not in here</description>
</t>
</y>
名字在这里
这里没有Html之类的,我很大胆
这里是名字2
这里没有一些Html之类的东西
在这里说出3个名字
这里没有一些Html之类的东西
问题是flash动态文本框不会将XML(HTML)读取为HTML,因此
I'm BOLD
标记在flash中不会显示为I'm BOLD??我错过了什么??谢谢。我找到了!!!而且很有效
在Flash中,我需要更改变量以识别HTML:
像这样:
name_txt.htmlText = _root.inventor;
comment_txt.htmlText = _root.comments;
然后在我的XML文件中,我需要使用CDATA,如下所示:
<description><![CDATA[This is <ul><li>bold</li><li>bold</li><li>bold</li><li>bold</li></ul>]]></description>
加粗 加粗 加粗 加粗 ]>