2 Replies Latest reply on Jul 26, 2011 9:52 AM by Flex harUI

    Unexplainable exception:  "The supplied DisplayObject must be a child of the caller"

    BRebey

      What am I missing in the following code?  How is the indicated exception possible?  It seems to me that it simply "can't happen", yet it reliably does.

       

      I'm checking to see if a component is a child of "this", and if it is, I attempt to remove that child.  The remove faults.  Any thoughts?

       

                  if (tf != null && this.contains(tf) == true)
                  {
                      this.removeChild(tf);   // Generates exception "The supplied DisplayObject must be a child of the caller"
                      tf=null;
                  }