代码之家  ›  专栏  ›  技术社区  ›  jsims281

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

  •  3
  • jsims281  · 技术社区  · 16 年前

    我需要生成一个可编辑的XML文件来为Flash网站提供内容。

    我正在用HTML表单生成文件,并且 htmlspecialchars 例如。:

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

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

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

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

    一旦代码被读取到闪存文件(AS3)中,是否有好的方法将其转换回?

    2 回复  |  直到 16 年前
        1
  •  2
  •   Ryan Smith    16 年前

    也许尝试一下:

    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/ )

        2
  •  -2
  •   Josh Leitzel    16 年前