7 Replies Latest reply on May 1, 2012 9:19 AM by kglad

    XML Loading by Password


      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 --------------------



                <name>Last, First</name>

                <grade1> 98 </grade1>

                <grade2> 87</grade2>

                <grade3> 62 </grade3>

                <grade4> 93 </grade4>

                <grade5> 96 </grade5>



                <name>Last, First</name>

                <grade1> 98 </grade1>

                <grade2> 87</grade2>

                <grade3> 62 </grade3>

                <grade4> 93 </grade4>

                <grade5> 96 </grade5>





      //-------------------- 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"){



      if(myName == "Last2First2" && myPass == "123456789"){



      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;


      //-------------------- 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!