3 Replies Latest reply on Feb 6, 2007 11:53 AM by Newsgroup_User

    Create a list from an XML file    no display

    Level 7
      I have a multiline Dynamic text box called projList.
      I am trying to populate it from an xml file and create a clickable list.
      The trace works but cannot get to display the list in the text box.
      As far as the clickable goes, haven't gotten that far yet.
      Help very much appreciated.

      The xml is structured like this:
      <?xml version="1.0" ?>
      - <images>
      - <pic>
      <Image>/Butler/Images/sfah2_small.jpg</Image>
      <Category>Institutional</Category>
      <Proj_title>FRESH AIR HOME</Proj_title>

      Please see code below:

      import mx.xpath.XPathAPI;
      var allproj_xml:XML = new XML();
      allproj_xml.ignoreWhite = true;
      allproj_xml.onLoad = function(success:Boolean) {
      trace("onload...");
      if (success) {
      trace("success...");

      var thePath_str:String = "/images/pic/Proj_title";
      var title_array:Array = XPathAPI.selectNodeList(this.firstChild,
      thePath_str);
      for (var i:Number = 0; i < title_array.length; i++) {
      trace(title_array .firstChild.nodeValue);
      projList.addItem(title_array
      .attributes.Proj_title);
      }
      } else {
      trace("error loading XML");
      }
      };
      allproj_xml.load("allimages.xml");
      stop();