Dynamically add component question?

Hi:

Here is part of my code in short:


public class TextInputWithAutoComplete extends TextInput
{

[INDENT]private function addComp():void{

list = new List();
list.id = "autoCompleteList";
list.x = 0;
list.y = 20;
list.addEventListener(MouseEvent.MOUSE_UP, handleMouseDown);

parentDocument.addChild(autoCompleteList); OR addChild(autoCompleteList); //my question is here

}[/INDENT]

private function handleMouseDown():void{
//TODO
}

}

I realized that if I do addChild, I can’t really see the dynamically added component, since flex did not reserve space for my List to display. So I do parentDocument.addChild, and then it appears no problem. My question is since it’s being added in the parentDocument, so it is suppose to be a component belong to parentDocument, so is that component still be able to call this handleMouseDown?

From my experience, it’s still able to, but which doesn’t make sense to me.

Can someone explain a little about why it can still work, or any better approach other than parentDocument.addChild

Thanks.