1 Reply Latest reply: Mar 14, 2013 8:01 PM by Chris Velevitch RSS

    how to remove an Element that was added from code?

    the.groover82 Community Member


      I have a custom BorderContainer component with 2 labels and 1 image.

      I added an instance of it to my application from code with addElement() and now I cannot make it disappear

      I try:


          for (var i:int=0;i<numElements;i++){

           if (getElementAt(i) is Card){

            if ((getElementAt(i) as Card).name.substr(0,6)=="cMover"){






      It finds it because it gets to removeElementAt(i); but the component remains visible.

      I also tried  removeElement(getElementAt(i)); no luck.

      What am I doing wrong?