未在XML中显示的字符
我试图编辑一个从Flash文件调用的XML文件,我注意到某些字母没有显示,比如字母“q”和“j”。下面是Flash文件中的脚本:未在XML中显示的字符,xml,actionscript-3,flash,Xml,Actionscript 3,Flash,我试图编辑一个从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 (_loc
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);
var max\u news\u items=5;
getTitletText=函数(新闻xml、条目索引)
{
var_loc2=news_xml.firstChild.childNodes;
var _loc1=_loc2[条目索引].firstChild;
返回(_loc1.firstChild.nodeValue);
};
GetBodyText=函数(新闻xml、条目索引)
{
var_loc2=news_xml.firstChild.childNodes;
var _loc1=_loc2[条目索引].firstChild.nextSibling;
返回(_loc1.firstChild.nodeValue);
};
GetEntry=函数(新闻xml,索引)
{
var_loc1=news_xml.firstChild.childNodes;
回报率(_loc1[指数]);
};
GetNewsCount=函数(新闻\u xml)
{
var_loc1=news_xml.firstChild.childNodes;
返回(_loc1.长度);
};
ShowNews=函数(新闻xml)
{
如果(!news_xml.firstChild.hasChildNodes())
{
content_txt.text=“无可用信息。”;
返回(0);
}//如果结束,则结束
var_loc5=news_xml.firstChild.childNodes;
content_txt.text=“”;
对于(变量loc1=0;_loc1<_loc5.length;++_loc1)
{
var\u loc3=GetTitleText(新闻xml,\u loc1);
var _loc2=GetBodyText(新闻xml,_loc1);
content_txt.htmlText=content_txt.htmlText+(“+”loc3+“
”);
content_txt.htmlText=content_txt.htmlText+(_loc2+“
”);
}//结束
};
AddNewsEntry=函数(新闻、标题、正文)
{
var_loc2=news_xml.createElement(“条目”);
如果(标题==“”)
{
title=“”;
}//如果结束,则结束
var_loc4=news_xml.createElement(“title”);
var\u loc7=news\u xml.createTextNode(title);
_loc4.儿童(loc7);
_loc2.附属物(loc4);
如果(正文==“”)
{
body=“(无)”;
}//如果结束,则结束
var_loc3=news_xml.createElement(“body”);
var\u loc6=news\u xml.createTextNode(body);
_loc3.附属物(loc6);
_loc2.附属物(loc3);
if(news_xml.firstChild.hasChildNodes())
{
news_xml.firstChild.insertBefore(_loc2,news_xml.firstChild.firstChild);
}
其他的
{
news_xml.firstChild.appendChild(_loc2);
}//如果需要,则结束
while(GetNewsCount(新闻xml)>最大新闻项)
{
news_xml.firstChild.lastChild.removeNode();
}//结束时
};
EditNewsEntry=函数(新闻xml、节点索引、标题、正文)
{
var\u loc1=GetEntry(新闻xml、节点索引);
如果(标题=“”&正文=“”)
{
_loc1.removeNode();
返回(0);
}
其他的
{
如果(标题==“”)
{
title=“(无)”;
}//如果结束,则结束
如果(正文==“”)
{
body=“(无)”;
}//如果结束,则结束
}//如果需要,则结束
_loc1.attributes.date=新日期().toString();
var _loc4=_loc1.firstChild.firstChild;
var _loc5=_loc1.firstChild.nextSibling.firstChild;
_loc4.nodeValue=标题;
_loc5.nodeValue=主体;
};
SaveNews=函数(news\u xml)
{
content_txt.htmlText=“保存和加载…”;
news_xml.xmlDecl=“”;
sendAndLoad(保存脚本,新闻xml);
};
RefreshNews=函数(新闻xml)
{
content_txt.htmlText=“正在加载…”;
加载(xml文件+“?”+新日期().getTime());
};
var xml\u file=“text\u 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=函数(成功)
{
如果(成功)
{
ShowNews(这个);
}
其他的
{
content_txt.text=“加载信息时出错。”;
}//如果需要,则结束
};
刷新新闻(新闻xml);
老实说,我对Flash和ActionScript几乎一无所知,所以我不知道从哪里开始解决这个问题。感谢您的帮助 您很可能没有在显示文本的文本字段中嵌入所有必需的字体字符 在Flash中,您可以选择文本字段,按“属性”面板中的“嵌入”按钮,然后设置需要嵌入的字符范围 最好将嵌入的字符限制在所需的最小集合,因为额外的glyph将增加SWF的大小