5 Replies Latest reply on May 11, 2011 6:50 AM by Ck188

    xml failed to display on the flash

    Ck188

      Try to display the xml data on the flash via the dynamic text. During the loop, only the last childnode nodevalue is display on the flash.

      Do a trace on all childnodes, it was success but flash keep showing the last childnode nodevalue only. Did i miss out any AS2 command.

      Appreciate your help

       

      Message was edited by: Ck188

        • 1. Re: xml failed to display on the flash
          Ned Murphy Adobe Community Professional & MVP

          Show your code... it sounds like you might be using something like textfield.text = something in a loop instead of appending the text...  textfield.text += something

          1 person found this helpful
          • 2. Re: xml failed to display on the flash
            Ck188 Level 1

            Hi, try to do as suggest. Unable to get the loop xml display on the flash. it always display the last childnode value.var myXML:XML = new XML();

            attach the code sample.

             

            myXML.ignoreWhite=true;
            myXML.load("ck.xml");
            myXML.ignoreWhite=true;
            myXML.onLoad = function(success)
            {
            if (success)
            {
            var myImage = myXML.firstChild.childNodes[3].childNodes;
            for (i=0; i<myImage.length; i++)
              {
               trace (i);
               var image = myImage[i].childNodes[1].firstChild.nodeValue;
                  inputtxt.text = image;
               trace (image);
              }
             
            }
            }

            • 3. Re: xml failed to display on the flash
              Ned Murphy Adobe Community Professional & MVP

              Here is what I was suggesting.  Is this what you tried?

               

              myXML.ignoreWhite=true;
              myXML.load("ck.xml");
              myXML.ignoreWhite=true;
              myXML.onLoad = function(success)
              {
              if (success)
              {
              var myImage = myXML.firstChild.childNodes[3].childNodes;
              for (i=0; i<myImage.length; i++)
                {
                 trace (i);
                 var image = myImage[i].childNodes[1].firstChild.nodeValue;
                   inputtxt.text += image; // or inputtxt.text += image + "\n";
                 trace (image);
                }
               
              }
              }

               

               

               

               

               

              • 4. Re: xml failed to display on the flash
                Ck188 Level 1

                with the change to inputtxt.text += image + "\n"; it can display all the childnodes.

                 

                but can't get each childnode to be display based on the loop counter.

                 

                Appreciate your help

                 

                • 5. Re: xml failed to display on the flash
                  Ck188 Level 1

                  with the change to inputtxt.text += image + "\n"; all childnodes are displayed at the sametime.

                   

                  Would like to display per childnode during the loop count.

                   

                  Appreciate