Hi

The code below was kindly provided (dawsonk ) to help me create a random name selector for the classroom. It works great but it doesn't like a space between two words. So I can't copy and paste a list with name and surname. It comes out with nonsense characters in the space.

Any ideas on how to remedy this?
Thanks

frame 1

stop();

var name = new Array();
var colour = new Array();
var letter = new Array();

function getRandInfo(fileName, info) {
var myLV = new LoadVars();
myLV.onLoad = function(success) {
if (success) {
for (var i in myLV) {
var tmpArray = escape(i).split("%0D%0A");
break;
}
var infoArray = new Array();
for (var i = 0; i<tmpArray.length; i++) {
if (tmpArray[i].length != 0) {
infoArray.push(tmpArray[i]);
}
}
var count = Number(random(infoArray.length));
info.push(infoArray[count]).toString();
play()
} else {
info.push("error").toString();
trace("Ooops there is something wrong - better check it out.");
}
};
myLV.load(fileName);
}


getRandInfo('names.txt',name);

frame 2


stop();
trace("Name: "+name);

getRandInfo('colours.txt',colour);

frame 3


stop();
trace("Colour: "+colour);