Okay, so I've made a login sytem for my students to use to check their scores in class. I currently have it set to load their scores from an xml file when they login using they're username and password, that's all good. My problem is that I want to minimize my file size. Currently, when they login, they are directed to the frame in my .fla for their info. I would like to have only the one frame for loading the data, so that their data is connected to their username and pasword and when they login in their data is loaded into the one frame I have created instead of having a frame for each individual student. Here is a sample of what my xml is like:
//-------------------- XML --------------------
<firstperiod>
<person>
<name>Last, First</name>
<grade1> 98 </grade1>
<grade2> 87</grade2>
<grade3> 62 </grade3>
<grade4> 93 </grade4>
<grade5> 96 </grade5>
</person>
<person2>
<name>Last, First</name>
<grade1> 98 </grade1>
<grade2> 87</grade2>
<grade3> 62 </grade3>
<grade4> 93 </grade4>
<grade5> 96 </grade5>
</person2>
</firstperiod>
//-------------------- XML End --------------------
I have their login hardcoded in to AS2:
//-------------------- AS2 Login Script --------------------
login.failed_txt.background = false;
login.failed_txt.border = false;
var myName:String;
var myPass:String;
loginBtn.onRelease = function (){
myName = username.text;
myPass = password.text;
if(myName == "Last1First1" && myPass == "12345678"){
gotoAndStop("FrameLabel1");}
if(myName == "Last2First2" && myPass == "123456789"){
gotoAndStop("FrameLabel2");}
else {
loginfailed_txt.text = "LOGIN IS INVALID";
}
}
//-------------------- AS2 Login Script End --------------------
//-------------------- AS2 XML Load Script --------------------
function loadXML(loaded) {
if (loaded) {
_root.firstperiod = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.grade1 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.grade2 = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.grade3 = this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
_root.grade4 = this.firstChild.childNodes[0].childNodes[4].firstChild.nodeValue;
_root.grade5 = this.firstChild.childNodes[0].childNodes[5].firstChild.nodeValue;
name_txt.text = _root.firstperiod;
grade1_txt.text = _root.grade1;
grade2_txt.text = _root.grade2;
grade3_txt.text = _root.grade3;
grade4_txt.text = _root.grade4;
grade5_txt.text = _root.grade5;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("studentscores.xml");
//-------------------- AS2 XML Load Script End --------------------
So instead of navigating to the student's frame in the .fla upon correctly entering thier login info, I want the the data to load in, oh let's say frame 2, where the dynamic text boxes are and get rid of all the superfluous frames. Does that make sense at all?
Any help would be greatly appreciated! Thanks!
you should use a database on your server to store the data you don't want to be publicly available. that probably includes the data in your xml file.
you'll also need server-side code to retrieve data from your database. you can use the loadvars class in flash to call your server-side code.
I've seen some tuts out their about running some php through your MYSQL server to secure it data and logins, I should be able to get that part figured out, but how about getting it so that when students login their data from my xml loads on frame 2 instead of having to have a frame for each of my 300+ students?
North America
Europe, Middle East and Africa
Asia Pacific