Hi there!
Do you know Kirupa’s News Editor tutorial?
O.K. I have problems with text formatting. I need “title” in a different font than “body”.
Here is the part of original code:
ShowNews = function(news_xml){
if (!news_xml.firstChild.hasChildNodes()){
content_txt.text = “No news available.”;
return (0);
}
var entries = news_xml.firstChild.childNodes;
content_txt.text = “”;
for (var i=0; i<entries.length; i++){
var title = GetTitleText(news_xml, i);
var body = GetBodyText(news_xml, i);
content_txt.htmlText += “<b>” + title +"</b><br>"
content_txt.htmlText += entries*.attributes.date + “<br>”
content_txt.htmlText += “------------------------<br>”
content_txt.htmlText += body +"<br><br>";
}
}
Title is bold formated with <b></b>. How to change a font?
I have tried with something like this:
myFormat = new TextFormat();
myFormat.font = “Arial”;
myFormat.size = 12;
myFormat.color = 0xFFFFFF;
content_txt.setTextFormat("" + title + “”, myFormat);
but it doesn’t work.
I have also tried with css, but it works only with AS2 and I need AS1.
I’m using embeded font with “content_txt” text box.
Thank you!