File I/O ?
#1
Posted 24 September 2011 - 04:57 AM
#2
Posted 24 September 2011 - 04:59 AM
Edited by Mayhem Games, 24 September 2011 - 05:00 AM.
#3
Posted 24 September 2011 - 05:12 AM
#4
Posted 24 September 2011 - 05:21 AM
Edited by Mayhem Games, 24 September 2011 - 05:21 AM.
#5
Posted 24 September 2011 - 05:31 AM
readfromreadme=function() {
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "readme.txt", false);
txtFile.onreadystatechange = function() {
if (txtFile.readyState === 4) { // Makes sure the document is ready to parse.
if (txtFile.status === 200) { // Makes sure it's found the file.
allText = txtFile.responseText;
lines = txtFile.responseText.split("\n"); // Will separate each line into an array
alert(lines);
}
}
}
txtFile.send(null);
}Call the function readfromreadme() in your game.
Then create readme.txt next to index.html and it will alert the lines in the file
Btw I got the file reading code from: http://social.msdn.m...25-8b3b9a078eab
Edited by TGMG, 24 September 2011 - 05:33 AM.
#6
Posted 24 September 2011 - 05:32 AM
Whoa awesome TGMG, exactly what I was looking for.
Edited by OMGCarlos, 24 September 2011 - 05:34 AM.
#7
Posted 24 September 2011 - 08:46 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











