0 Replies Latest reply on Nov 21, 2006 6:08 PM by Newsgroup_User

    Small XML problem

    Level 7
      Hi Dudes:

      Sure could use some help if someone can tell me whats wrong with my
      code. It populates my list component and my texfields fine but when I
      click the names in the list component it only does it for the second
      name (on;y once). Thanks in advance...

      var languageXML:XML = new XML();

      var masterArray:Array = new Array();

      languageXML.ignoreWhite = true;

      languageXML.onLoad = function(success) {
      var currentLangNode:XMLNode = this.firstChild.firstChild;
      var i:Number = 0;
      for (var childNode = currentLangNode; childNode != null; childNode =
      childNode.nextSibling, i++) {
      var j:Number = 0;
      masterArray = new Array();
      masterArray
      [0] = childNode.nodeName;
      j++;
      for (var stringNode:XMLNode = childNode.firstChild; stringNode !=
      null; stringNode = stringNode.nextSibling, j++) {
      masterArray [j] = stringNode.firstChild.nodeValue;
      }
      }
      for (var k=0; k < masterArray.length; k++) {
      lang_ls.addItem(masterArray[k][2]);
      }

      foto.contentPath = masterArray[0][1];
      name_txt.text = masterArray[0][2];
      hometown_txt.text = masterArray[0][3];
      contact_txt.text = masterArray[0][4];
      dob_txt.text = masterArray[0][5];
      height_txt.text = masterArray[0][6];
      weight_txt.text = masterArray[0][7];
      position_txt.text = masterArray[0][8];
      school_txt.text = masterArray[0][9];
      graduates_txt.text = masterArray[0][10];
      gpa_txt.text = masterArray[0][11];
      sat_txt.text = masterArray[0][12];
      profile_txt.text = masterArray[0][13];
      merits_txt.text = masterArray[0][14];
      }


      var langListener:Object = new Object();

      langListener.change = function (eventObj) {
      for (var l=0; l < masterArray.length; l++) {
      if (masterArray[1][2] == eventObj.target.value) {
      foto.contentPath = masterArray[1][1];
      name_txt.text = masterArray[1][2];
      hometown_txt.text = masterArray[1][3];
      contact_txt.text = masterArray[1][4];
      dob_txt.text = masterArray[1][5];
      height_txt.text = masterArray[1][6];
      weight_txt.text = masterArray[1][7];
      position_txt.text = masterArray[1][8];
      school_txt.text = masterArray[1][9];
      graduates_txt.text = masterArray[1][10];
      gpa_txt.text = masterArray[1][11];
      sat_txt.text = masterArray[1][12];
      profile_txt.text = masterArray[1][13];
      merits_txt.text = masterArray[1][14];
      break;
      }
      }
      }

      lang_ls.addEventListener("change", langListener);

      languageXML.load("promesas.xml");