2 Replies Latest reply on Aug 8, 2011 5:36 AM by r4raghs

    How to add and remove component to Group in flex4

    AVKRFLEX

      Hi Folks,


      I have faced this issue, the issue is "I cretaed custom component Gropup " and then

      I have button , 1) when i click on that button  adding componenets to that group.

                           2) When i click on the same button second time ..those componenets should be remove(what i added before)


            The problem is what  i am getting  error "RangeError: Index 2 is out of range." while removing last element


                     Code is :       if(group.numElements == 3){

                                                   try{

                                                      for(var j:int = 2; j > 0; j--){

                                                            group.removeElementAt(j);

                                                           }

                                                         }catch(e:RangeError){

                                                        trace("Index out of range");

                                                }

                                         }



      Please let me help if anybody know this issue

       

       

      Thanks & Regards,

      Anderson