代码之家  ›  专栏  ›  技术社区  ›  Brittany Layne Rapheal

XML中未显示的字符

  •  0
  • Brittany Layne Rapheal  · 技术社区  · 11 年前

    我试图编辑一个从Flash文件调用的XML文件,我注意到某些字母没有显示,比如字母“q”和“j”。这是Flash文件中的脚本:

    var max_news_items = 5;
    GetTitleText = function (news_xml, entry_index)
    {
        var _loc2 = news_xml.firstChild.childNodes;
        var _loc1 = _loc2[entry_index].firstChild;
        return (_loc1.firstChild.nodeValue);
    };
    GetBodyText = function (news_xml, entry_index)
    {
        var _loc2 = news_xml.firstChild.childNodes;
        var _loc1 = _loc2[entry_index].firstChild.nextSibling;
        return (_loc1.firstChild.nodeValue);
    };
    GetEntry = function (news_xml, index)
    {
        var _loc1 = news_xml.firstChild.childNodes;
        return (_loc1[index]);
    };
    GetNewsCount = function (news_xml)
    {
        var _loc1 = news_xml.firstChild.childNodes;
        return (_loc1.length);
    };
    ShowNews = function (news_xml)
    {
        if (!news_xml.firstChild.hasChildNodes())
        {
            content_txt.text = "No info. available.";
            return (0);
        } // end if
        var _loc5 = news_xml.firstChild.childNodes;
        content_txt.text = "";
        for (var _loc1 = 0; _loc1 < _loc5.length; ++_loc1)
        {
            var _loc3 = GetTitleText(news_xml, _loc1);
            var _loc2 = GetBodyText(news_xml, _loc1);
            content_txt.htmlText = content_txt.htmlText + ("<u><b>" + _loc3 + "</b><br></u>");
            content_txt.htmlText = content_txt.htmlText + (_loc2 + "<br><br>");
        } // end of for
    };
    AddNewsEntry = function (news_xml, title, body)
    {
        var _loc2 = news_xml.createElement("entry");
        if (title == "")
        {
            title = "";
        } // end if
        var _loc4 = news_xml.createElement("title");
        var _loc7 = news_xml.createTextNode(title);
        _loc4.appendChild(_loc7);
        _loc2.appendChild(_loc4);
        if (body == "")
        {
            body = "(none)";
        } // end if
        var _loc3 = news_xml.createElement("body");
        var _loc6 = news_xml.createTextNode(body);
        _loc3.appendChild(_loc6);
        _loc2.appendChild(_loc3);
        if (news_xml.firstChild.hasChildNodes())
        {
            news_xml.firstChild.insertBefore(_loc2, news_xml.firstChild.firstChild);
        }
        else
        {
            news_xml.firstChild.appendChild(_loc2);
        } // end else if
        while (GetNewsCount(news_xml) > max_news_items)
        {
            news_xml.firstChild.lastChild.removeNode();
        } // end while
    };
    EditNewsEntry = function (news_xml, node_index, title, body)
    {
        var _loc1 = GetEntry(news_xml, node_index);
        if (title == "" && body == "")
        {
            _loc1.removeNode();
            return (0);
        }
        else
        {
            if (title == "")
            {
                title = "(none)";
            } // end if
            if (body == "")
            {
                body = "(none)";
            } // end if
        } // end else if
        _loc1.attributes.date = new Date().toString();
        var _loc4 = _loc1.firstChild.firstChild;
        var _loc5 = _loc1.firstChild.nextSibling.firstChild;
        _loc4.nodeValue = title;
        _loc5.nodeValue = body;
    };
    SaveNews = function (news_xml)
    {
        content_txt.htmlText = "<i>Saving and Loading...</i>";
        news_xml.xmlDecl = "";
        news_xml.sendAndLoad(save_script, news_xml);
    };
    RefreshNews = function (news_xml)
    {
        content_txt.htmlText = "<i>Loading...</i>";
        news_xml.load(xml_file + "?" + new Date().getTime());
    };
    var xml_file = "text_store/leasing.xml";
    var save_script = "leasing_save.php";
    var news_xml = new XML();
    news_xml.ignoreWhite = true;
    news_xml.contentType = "text/xml";
    news_xml.onLoad = function (success)
    {
        if (success)
        {
            ShowNews(this);
        }
        else
        {
            content_txt.text = "Error loading Info.";
        } // end else if
    };
    RefreshNews(news_xml);
    

    老实说,我对Flash和ActionScript几乎一无所知,所以我不知道从哪里开始解决这个问题。感谢您的帮助!

    1 回复  |  直到 11 年前
        1
  •  0
  •   Cadin    11 年前

    您很可能没有在显示文本的文本字段中嵌入字体所需的所有字符。

    在Flash中,您可以选择文本字段,按财产面板中的嵌入按钮,然后设置需要嵌入的字符范围。

    最好将嵌入的字符限制在所需的最小集合内,因为额外的字形会增加SWF的大小。