3 Replies Latest reply on Jan 17, 2011 2:05 PM by snunicycler

    what is wrong with my code?

    snunicycler Level 3

      here is my new code that works for PART of my movie. i have two dynamic text boxes, one named "item" and one named "ssnumber"


      ssnumberNode works fine but itemNode does not. i bolded the parts that i think are relevant to the problems


      on (rollOver) {
          function processXMLData(success)
          if (success)
              var rootNode=this.firstChild.childNodes[0];

              var itemNode=findNode(rootNode, "item");
              var ssnumberNode=findNode(rootNode, "ssnumber");

              content="oops, this is hard";

      function getValue(node)

      if (node && node.firstChild)               >what does this part mean?
            return node.firstChild.nodeValue;
        return "?";

      function findNode(node, nodeName)
          if (node.nodeName==nodeName)
              return node;
          for (var i=0; node.childNodes && i<node.childNodes.length; i++)
              var foundNode=findNode(node.childNodes[i], nodeName);
              if (foundNode!=null)
                  return foundNode;
          return null;

      var xmlData=new XML();

      the part that says " if(node && node.firstChild) return  node.firstChild.nodeValue; return "?" is the thing that is giving me  trouble. the question mark shows up on my dynamic text box called "item"  but the "ssnumber" one works fine. if i delete that part alltogether,  both item and ssnumber return "undefined". what is wrong with my code  that is keeping item from working?

      Picture 1.png


      here is that part of the xml

      Picture 2.png

        • 1. Re: what is wrong with my code?
          Ned Murphy Adobe Community Professional & MVP

          What happens when you remove the line...

          return "?";
          • 2. Re: what is wrong with my code?
            snunicycler Level 3

            when i remove that part it returns "null"

            i figured it out though. i hate it when the problem is something totally stupid and  small. like missing a bracket or not closing a tag correctly, in my case  i had a small space in my code that should not have been there. i  figured it out and now it works. the sad part is, i have been staring at  my monitor since 930 this morning trying to figure it out. i have had  my coworkers come in and check it out too. it evaded all of us.  sheesh......

            • 3. Re: what is wrong with my code?
              snunicycler Level 3

              just a side question though (weird how everytime i figure something out, something else doesn't work)...

              i got the info to display when one part is moused over. i want the info for another part to replace that text when the other part is moused over.

              this is how i have it organized. the P01LEM14139 is the part number.  so when i go to the next part i need the dynamic text to skip the first one and display the info for the second one.

              <?xml version="1.0" encoding="utf-8"?>
                          <item><p>Pedal Strap With Toe Cage and Straps</p></item>
                          <item><p>Arm, Crank, Stainless Steel (Left)</p></item>
                          <item><p>Crank Arm Bolt, Each</p></item>


              i copied and pasted the code from the first button and added this to the code that i had:


              var crankarmNode=this.firstChild.childNodes[1];


              and i changed the rootNode parts to crankarmNode so now it SHOULD (if i understand this all correctly) go to the firstChild.childNodes[1] (which is the part i need the info for) the problem is that it returns "null" for both text boxes.

              Picture 3.png

              am i not allowed to do that? or should i write that part a different way?