I’ve created a XML-dynamic news box which uses a external .CSS
Since my hosting is slow, when I load my movie of the news box, some of the times CSS doesn’t seem to do its work – All I see is the html code that I created in the XML file.
I was wondering how I preload the css and xml before executing/using it.
function xmlLoad(newXml, cssUrl) {
//formatting textfield
myText.setStyle("background", false);
myText.setStyle("backgroundColor", 0xffffff);
myText.setStyle("embedFonts", true);
myText.html = true;
//loading stylesheet
var xmlCss:TextField.StyleSheet = new TextField.StyleSheet();
xmlCss.onLoad = function(success) {
if (success) {
myText.styleSheet = xmlCss;
} else {
myText.text = "Stylesheet not loaded!";
}
};
xmlCss.load(cssUrl);
//loading xml
var menuXML:XML = new XML();
menuXML.load(newXml);
menuXML.ignoreWhite = true;
menuXML.onLoad = function(success) {
if (success) {
myText.text = this.firstChild;
}
};
}
xmlLoad("htmlinxml2004.xml", "body.css");