Hi,
In the code below, I’ve called to several xml objects and functions with repetitive behavior, it functions fine. However would someone offer a solution for pruning this bramble?
//Create a new style sheet object
var flaCSS = new TextField.StyleSheet();
//Specify the location of the CSS file.
var cssURL = "c/core.css";
//Load CSS file
flaCSS.load(cssURL);
//define onLoad handler
flaCSS.onLoad = function(success) {
if (!success) {
trace("Document Failed To Load");
}
};
/*
//Create the text format object.
var formatText:TextFormat = new TextFormat();
formatText.font = "Verdana";
formatText.color = 0xFEFEFE;
formatText.size = 9;
//
*/
//Create and populate the about xml object
var aboutXML:XML = new XML();
aboutXML.onLoad = handleAboutData;
aboutXML.load("x/about.xml");
function handlAboutData(success) {
if (!success) {
trace("Document Failed To Load");
}
}
//
//Create and populate the services xml object
var servicesXML:XML = new XML();
servicesXML.onLoad = handleServicesData;
servicesXML.load("x/services.xml");
function handleServicesData(success) {
if (!success) {
trace("Document Failed To Load");
}
}
//
//Create and populate the meditation xml object
var meditationXML:XML = new XML();
meditationXML.onLoad = handleMeditationData;
meditationXML.load("x/meditation.xml");
function handleMeditationData(success) {
if (!success) {
trace("Document Failed To Load");
}
}
//
//Create and populate the portfolio xml object
var portfolioXML:XML = new XML();
portfolioXML.onLoad = handlePorfolioData;
portfolioXML.load("x/portfolio.xml");
function handlePortfolioData(success) {
if (!success) {
trace("Document Failed To Load");
}
}
//
function loadServices() {
this.main_mc.main_txt.styleSheet = flaCSS;
this.main_mc.main_txt.htmlText = servicesXML;
this.main_mc.main_txt.html = true;
//this.main_mc.main_txt.setTextFormat(formatText);
}
function loadAbout() {
this.main_mc.main_txt.styleSheet = flaCSS;
this.main_mc.main_txt.htmlText = aboutXML;
this.main_mc.main_txt.html = true;
//this.main_mc.main_txt.setTextFormat(formatText);
}
function loadMeditation() {
this.main_mc.main_txt.styleSheet = flaCSS;
this.main_mc.main_txt.htmlText = meditationXML;
this.main_mc.main_txt.html = true;
//this.main_mc.main_txt.setTextFormat(formatText);
}
function loadPortfolio() {
this.main_mc.main_txt.styleSheet = flaCSS;
this.main_mc.main_txt.htmlText = portfolioXML;
this.main_mc.main_txt.html = true;
//this.main_mc.main_txt.setTextFormat(formatText);
}