2 Replies Latest reply on Feb 20, 2009 9:06 AM by robbyk87

    For loop - addChild


      My for loop checks the value of xml so say:

      for (var i:int = 0; i<count; i++){

      it checks:

      var authorName:String = evt.result.news.authorname ;

      being [0][1][2] etc - I then need the info dynamically generated. At the moment I am struggling to get both values from xml to generate in a VBox in a viewstack selected index=0.

      The closest I ahve come is to have both values generated but twice so 4 lots instead of 2.

      anyone ahve any ideas?
        • 1. Re: For loop - addChild
          robbyk87 Level 1
          ok I seem to ahve fixed it by maknig it a while loop and adding a removeChildAt command.

          Without the remove child command it duplicates everything! So I get two lots of date:1 and two lots of date:2 and so on. Can anybody tell me why I am getting these duplicates please? becuase im not sure the removeChildAt should really be there in a loop.

          any help extremely welcome!
          • 2. Re: For loop - addChild
            robbyk87 Level 1
            OMG, my fault entirely - script works fine without the removeChild.

            It was because I was calling the ResultEvent twice from the MXML soooooo soo so STUPID!

            Never make that mistake guys - you've been warned!