8 Replies Latest reply on Jul 14, 2009 8:44 AM by kglad

    Help with loading xml into dynamic text field

    mmwhm

      Hi,
      I have an xml feed generated from our CMS. It sends lot availability to a flash map. The map has some buttons that will change color based on availability. There is also a tooltip that I would like to display 2 more fields that the xml is sending....price and model number. I am not sure how to get this to work when one rolls over each individual lot button

       

      This is the actionscript in each of the 4 neighborhood frames:

      var _xml:XML = new XML();
      _xml.ignoreWhite = true;
      _xml.onLoad = myLoad;
      var child = _xml;

       

      function myLoad(ok)
      {
      if (ok == true) {
      // for each node in the xml file
      var index =0;

       

      while (index < _xml.firstChild.childNodes.length){
      //var objecttitle = _xml.childNodes[0].childNodes[index].childNodes[0].childnodes[0].nodeValue;
      var objecttitle = _xml.firstChild.childNodes[index].childNodes[0].childNodes[0].nodeValue;

       


      if (objecttitle.indexOf("Neighborhood1") >= 0){

       

      var lotnumber = _xml.firstChild.childNodes[index].childNodes[1].childNodes[0].nodeValue;
      var ourstatus = _xml.firstChild.childNodes[index].childNodes[2].childNodes[0].nodeValue;
      var price = _xml.firstChild.childNodes[index].childNodes[3].childNodes[0].nodeValue;
      var model = _xml.firstChild.childNodes[index].childNodes[4].childNodes[0].nodeValue;

       

      var colorful = new Color("_root.Lot" + lotnumber);

       

      trace(colorful);

       

      if (ourstatus == "Sold"){
      colorful.setRGB(0xFF3366);
      }else if (ourstatus == "Pending"){
      colorful.setRGB(0xFFCC33);
      }else{
      colorful.setRGB(0x00FF00);
      }

       

      }

       

      index++;
      }
      }
      }

       

      _xml.load("XMLFeed.aspx?ObjectType=Lot&SortPropert y=Lot Number");

       


      This dynamic text fields are located in a movieclip located at:
      _root.tooltip.pricefield
      _root.tooltip.modelfield

       

      Each Button has an instance name, e.g. "Lot 100"

       

      Here is an example of (not the full) xml:

       

      <ContentManagementObjects>
      <Lot>
      <Title>Neighborhood1</Title><LotNumber>1</LotNumber><Status>Pending</Status><Price>$1,100, 000</Price><Floorplan>Model A</Floorplan></Lot>
      <Lot>
      <Title>Neighborhood1</Title><LotNumber>2</LotNumber><Status>Pending</Status><Price>$1,100, 500</Price><Floorplan>Model A</Floorplan></Lot>
      <Lot>
      <Title>Neighborhood1</Title><LotNumber>3</LotNumber><Status>Sold</Status><Price>$1,100,000 </Price><Floorplan>Model A</Floorplan></Lot>
      <Lot>
      <Title>Neighborhood2</Title><LotNumber>1</LotNumber><Status>Sold</Status><Price>$1,300,000 </Price><Floorplan>Model B</Floorplan></Lot>
      <Lot>
      <Title>Neighborhood2</Title><LotNumber>2</LotNumber><Status>Sold</Status><Price>$1,550,000 </Price><Floorplan>Model B</Floorplan></Lot>
      </ContentManagementObjects>

       

      What do I have to do to get the price and model name into the dynamic text fields in the tooltip whenever one rolls over that unique button.

       

      Thanks in Advance.