1 Reply Latest reply on Sep 9, 2010 7:59 AM by laxmidi

    ArrayCollection has Repeated Node

    laxmidi Level 1



      I'm using an PagableArrayCollection to populate a datagrid and a regular arrayCollection to populate some boxes in a canvas. The PagableArrayCollection can be found here http://pagableac.riaforge.org/ . I have a function called grader() which returns a grade as a string.


      Everything works great if myDataArray is one node. But, f it is more then one node, then for some reason it repeats the first node. So, If myDataArray has 3 nodes-- info regarding Joe, Bob, and Mary-- it will repeat Joe's node. In mainInitDG and mainGradeAC there will be 4 nodes containing info regarding Joe, Joe, Bob, Mary. The first node gets repeated.


      Any ideas as to what the heck is going on?



      public function GridBuilder(myDataArray:Array):void {
           var i:uint; 
              for (i=0; i<myDataArray.length; i++){
           mainDGArray.push({Type: 'Small:', Score: myDataArray[i].score}, {Type: 'Big:', Score: myDataArray[i].score}); 
              gradeRankArray.push({Name: myDataArray[i].name, Rank: myDataArray[i].rank, Grade:(grader(myDataArray[i].rank, myDataArray[i].max_rank))});                                                        
                mainInitDG = new PagableArrayCollection(mainDGArray);
                      mainInitDG.itemsPerPage = 2;
                mainGradeAC = new ArrayCollection(gradeRankArray);
                var _myCard:mainCard = this["mainCard"+cardNum];
                _myCard.mainInitDG = mainInitDG;
                _myCard.mainGradeAC = mainGradeAC;


      If anyone has any ideas, I'd love to hear them. Thank you.