4 Replies Latest reply: May 8, 2012 7:53 AM by tripleA999 RSS

    tilelist and xml

    tripleA999 Community Member

      I am unable to load pics from xml to TileList

       

      I tried to add through Array & addItem , but both are not working

       

      below is code , when xml is loaded

       

      function clipsXmlLoaded(event:Event):void
      {
          clipsXml = XML(clipxmlLoader.data);
          trace(clipsXml);
          for(var c:int = 0; c<clipsXml.length ; c++ )
          {
              //clipsArray.push ({label:"" , source:String(clipsXml.clip[c])});
              clips_list.addItem({source:String(clipsXml.clip[c])});
                  trace(clipsXml);
      
          }
          trace("clips");
          //clips_list.dataProvider = new DataProvider(clipsArray);
      }
      
        • 1. Re: tilelist and xml
          Ned Murphy CommunityMVP

          The Array class is not the same as the XML class.  You might need to revise your code to agree with the methods of the XML class.  You seem to be using them as properties.   Try...

           

          function clipsXmlLoaded(event:Event):void
          {
              clipsXml = XML(clipxmlLoader.data);

              for(var c:int = 0; c<clipsXml.length(); c++ )
              {
                  clips_list.addItem({source:String(clipsXml.clip[c].text())});
              }
          }

          • 2. Re: tilelist and xml
            tripleA999 Community Member

            this Line not works in loop

            clips_list.addItem({source:String(clipsXml.clip[c])});

             

            but when I use outside the loop IT WORKS like this :

             

            clips_list.addItem({source:String(clipsXml.clip[1])});

            clips_list.addItem({source:String(clipsXml.clip[2])});

            clips_list.addItem({source:String(clipsXml.clip[3])});

             

            loop is not working , but it tracing path also fine

            • 3. Re: tilelist and xml
              bhargavi reddy Community Member

              clipsXml.length() gives only 1. Thats your loop is not executed. First retrieve your nodes length in xml file then you get the output.

              • 4. Re: tilelist and xml
                tripleA999 Community Member

                somtime Minor error creates so much time wast