将HTML字符转换回Flash中的文本 - AS3

时间:2009-04-23 23:12:43

标签: php xml flash actionscript-3 htmlspecialchars

我需要生成一个可编辑的xml文件,以便为Flash网站提供内容。

我使用html表单生成我的文件,htmlspecialchars例如:

    $currentItem = htmlspecialchars(stripslashes($currentItem));

这是为了防止xml条目产生错误“XML解析错误:格式不正确”,例如

<entry title="Words & Things">
---------------------^

它的副作用是使flash文件显示内容的html代码,而不是正确的字符。

一旦将代码读入Flash文件(as3),是否有一种很好的方法可以将代码转换回来?

2 个答案:

答案 0 :(得分:2)

也许试试:

public function htmlUnescape(str:String):String
{
    return new XMLDocument(str).firstChild.nodeValue;
}

(发现于:http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/

答案 1 :(得分:-2)