1 Reply Latest reply on Oct 19, 2009 8:17 AM by Flex harUI

    XMLList returns null if only 1 member

    Handycam Level 1

      I am creating 3 XMLLists to store/send data for my application. I am looping through an XMLList, pulling out pieces and adding stuff we need, building a new XML file and storing that into an XMLList to be sent via a web service.


      The problem I am having is that if the XMLList has only one member, I get nothing.  Consider:


      //first the recipe ids and courses, format <recipe id="54306" course="mainCourse"/>:
      for each (var x:XML in menuList){
           var newNode:XML = <recipe/>;
           newNode.@id = x.id.toString();
           newNode.@course = x.@course.toString();
           recipeData+= newNode;


      If menuList has one member:



      If menuList has 2 members:
      Recipes=<recipe id="54306" course="mainCourse"/>
      <recipe id="80788" course="mainCourse"/>
      Why is this?