Hi,
I have this mc containing a dynamic text field and the stuff for this text field is loaded from a .txt file.
In my .txt I have variables named …,txt4, txt3, txt2, txt1, txt0, which are basically html texts.
What I need to do and I don’t know how is to have some method to change which variable should be loaded, i.e. txt2 after txt3.
This is the code that I have for geting the text:
stop();
var myCSS = new TextField.StyleSheet();
myCSS.load("style.css");
myCSS.onLoad = function(success) {
if (success) {
loadTekst(myCSS);
} else {
err.text = "Could not load CSS style sheet";
}
};
loadTekst = function (style) {
loadText = new LoadVars();
if ((_root.langchoice == "pl") || (_root.langchoice == undefined)) {
err.text = "wczytuje tekst";
loadText.load("news_pl.txt");
} else if (_root.langchoice == "en") {
err.text = "loading text";
loadText.load("news_en.txt");
}
loadText.onLoad = function(success) {
if (success) {
info_mc.info.[color=black]htmlText[/color] = true;
info_mc.info.styleSheet = style;
info_mc.info.htmlText = txt; //<---- this has to be changed
gotoAndPlay(2);
} else {
err.text = "Error loading the info text file";
}
};
};
I thought about using another variable that could store the number of the items but still, I need a way to manipulate the [color=red][color=darkred]info_mc.info.htmlText =[/color] [color=red]txt[/color]; [/color][color=black]so it loads the required txt variable.[/color]
Any thoughts on how to do it?
Thanks