Easy if you know how? I just dont know how!
Hi Guys...
I am learning AS quickly but need some help simplyfying this bit of code, I have to create 43 of them and know that there must be a more simplyfied way of doin it! Can anyone show me the light?
Code:
thisText = new LoadVars();
thisText.load("exhibitor1.txt");
thisText.onLoad = function(success) {
if (success) {
title1.text = thisText.exhibitor1_name;
}
}
thisText2 = new LoadVars();
thisText2.load("exhibitor2.txt");
thisText2.onLoad = function(success) {
if (success) {
title2.text = thisText2.exhibitor2_name;
}
}
Thanks
Maybe you can adapt this to what you are trying to do...
Code:
stop();
var _MAIN = this;
for (var i = 1; i <= 43; i++) {
var myText = _MAIN["thisText" + i];
myText = new LoadVars();
myText.load("exhibitor" + i + ".txt");
myText.num = i;
myText.onLoad = function(success) {
if (success) {
_MAIN["title" + this.num].text = this["exhibitor" + this.num + "_name"];
}
};
}
/*
// ***** Note, changes the first to include the number '1', so it mirrors the subsequent ones. So it would be like this...
thisText1 = new LoadVars();
thisText1.load("exhibitor1.txt");
thisText1.onLoad = function(success) {
if (success) {
title1.text = thisText1.exhibitor1_name;
}
};
*/