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

发布于 2024-07-17 04:50:52 字数 448 浏览 6 评论 0原文

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

我正在使用 html 表单和 htmlspecialchars 生成文件,例如:

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

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

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

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

一旦代码被读入 Flash 文件(as3),有没有一种好的方法可以将它们转换回来?

I need to generate an editable xml file to supply content to a flash website.

I am generating my file with a html form, and htmlspecialchars e.g.:

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

This is to prevent xml entries which would produce the error "XML Parsing Error: not well-formed", such as

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

It has the side effect of making the flash file display the html codes for the content, rather than the proper characters.

Is there a good way to convert the codes back, once they are read into the Flash file (as3)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

狼亦尘 2024-07-24 04:50:52

也许可以尝试:(

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/

Maybe try:

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

(Found at: http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文