0 Replies Latest reply on Jan 8, 2010 9:23 PM by artificiallyreal

    Problem: XML object in ArrayCollection All Identical

    artificiallyreal

      Good day,

       

      I'm new to the forum and apologise if this discussion is in the wrong location. I'm very stuck with a particular problem. I am generating a series of XML objects via a private function within a component class and adding these to a arrayCollection. Each time an XML object is added to the arrayCollection all other XML objects in the arrayCollection become identical to the last object added.

       

       

      private function setTypes():void
                {
                     setTypesArr.removeAll();
                     for(var i:Number=0; i<_attArray.length; i++)
                     {
                          var passXML:XML = passAttTypes(i+1);
                          setTypesArr[i] = passXML;
                     }
                }
      

       

       

      private function passAttTypes(curAtt:Number):XML
                {
                     
                     var attList:XMLList = _attTypesArr.children();
                     
                     for each(var att:AttributeVO in _attArray)
                     {     
                          if(att.attNumber != curAtt)
                          {
                               
                               for each(var type:XML in attList)
                               {
                                    var attType:Number = Number(type.@number.toString());
                                    if(att.attType == attType)
                                    {
                                         type.@enabled = false;
                                    }
                               }
                          }else{
                               for each(var t:XML in attList)
                               {
                                    var AttType:Number = Number(t.@number.toString());
                                    if(att.attType == AttType)
                                    {
                                         t.@enabled = true;
                                    }
                               }
                          }
                     }
      
      

       

       

      Any suggestions more than welcome.

       

      regards,

       

      Rob