How to test for type

I have an array that holds several different components (e.g., radio buttons, comboboxes, etc).

I would like to loop through each component and add event listeners to those components that are radio buttons.

How do I test to see if the component in question is a radio button? Here’s what I have that, obviously, does not work:



private function addRadioListeners():void {

    //By the way, "Component" is a custom class that can represent any type of
    //component
    for each (var comp:Component in componentArray) {
        if(comp == RadioButton) {
            //Code to add listeners here
        }
    }
}