Making a smart component

in Macromedia flash MX i noted that the scollbar component when is droped over a textbox, it take the name of that textbox like a target text box… how is this done? I mean, how the component knows where i’m droping him?? and how it knows that is a textbox object and no another thing…

Thanks!