i have a lots fact in sentence like “Copenhagen is the capital of Denmark”…I want them to be loaded from the external file a be random displayed in a dynamic text box…thats about it…does it make sence??
[AS]lv = new LoadVars();
lv.onLoad = function(success) {
if (success) {
var prop = null, facts = [];
for (prop in this) {
facts[facts.length] = this[prop];
} myTextFieldInstanceName.text = facts[Math.floor(Math.random()*facts.length)];
} else {
trace(“error”);
}
};
ASSetPropFlags(lv, “onLoad”, 1, 0);
lv.load(“data.txt”);[/AS]
Just replace myTextFieldInstanceName with the actual instance name of your TextField.
You could also use something like this:
[AS]for (prop in this) {
if (typeof this[prop] != “function”) {
facts[facts.length] = this[prop];
}
}
//
for (prop in this) {
if (!this[prop] instanceof Function) {
facts[facts.length] = this[prop];
}
}[/AS]