1 Reply Latest reply on Feb 5, 2011 10:09 PM by Flex harUI

    Add a node in XMLListCollection

    2009 Matt Level 1

      I have an university XML something like:


      var universityXML:XML =




               <department name="English" ... > ... </department>

                <department name="Math" ... > ... </department>





      I create a department list with


      var departmentList:XMLListCollection = new XMLListCollection(universityXML.departments.department.@name);


      How do I add a new department in the departmentList?


      I tried


      var deptNode:XML =<department/>;
      deptNode.@name = "Computer Science";
      departmentList.addItemAt(deptNode, 0);


      but it did not add the item. I guess something wrong with my deptNode? Any suggestions? Thanks