I have a text file variable that I have being loaded and split into an array. The text file already has the necessary CSS tags. The variable is imported fine and does what I want it to do based on a lot of searching here, however I can’t get the css to show up no matter what. It’s been hours now and I’m on my last nerve. If anyone can help me out would be most appreciated
Thanks
//timer function
amount = 3000;
function timeStop(x){
time=x;
function playNext() {
clearInterval(hold);
gotoAndPlay(_currentframe+1);
}
hold = setInterval(playNext, time);
stop();
}
//Random Quotes
so = SharedObject.getLocal("LastSelection");
ranQuote = new LoadVars();
ranQuote.onLoad = function(success) {
//split the variable from the text file and turn to array
if (success) {
images_array = this.quote.split("|");
checkLast = function (t) {
lastSelection = so.data.LS;
if (t != lastSelection) {
quote_txt.text = images_array[t];
so.data.LS = t;
so.flush();
} else {
randomSelect();
}
};
//random select number from array, then call function that checks whether its repeated or not.
randomSelect = function () {
num = random((images_array.length));
//trace(num);
if (so.data.LS == undefined) {
so.data.LS = 1510210;
so.flush();
}
checkLast(num);
};
randomSelect();
}else {
quote_txt.text = "Text Load Failure";
}
}
ranQuote.load("quotes2.txt");
Here is the code I used for the CSS just to test if it works but I am unsure how to combine the above code and this one to get them to work correctly. This test here is using the variable directly from the text file, not using the split up variable in an array like I need to.
var format = new TextField.StyleSheet();
var path = "styles.css";
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
quote_txt.styleSheet = format;
myLoadVar = new LoadVars ();
myLoadVar.load("quotes2.txt")
myLoadVar.onLoad = function (success){
if (success == true) {
quote_txt.variable = "quote"
quote_txt.htmlText=myLoadVar.quote;
}
}
} else {
quote_txt.text = "Error loading CSS file!";
}
};